Skip to content

Commit

Permalink
Improve docs about inherited settings
Browse files Browse the repository at this point in the history
Co-authored-by: John Gee <john@ruru.gen.nz>
  • Loading branch information
aweebit and shadowspawn authored Jul 29, 2023
1 parent 55b9146 commit dfe2fc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ subcommand is specified ([example](./examples/defaultCommand.js)).

You can add alternative names for a command with `.alias()`. ([example](./examples/alias.js))

Commands added with `.command()` automatically inherit settings for which inheritance is meaningful from the parent command, but only upon the subcommand creation. The setting changes made after calling `.command()` are not inherited.
`.command()` automatically copies the inherited settings from the parent command to the newly created subcommand. This is only done during creation, any later setting changes to the parent are not inherited.

For safety, `.addCommand()` does not automatically copy the inherited settings from the parent command. There is a helper routine `.copyInheritedSettings()` for copying the settings when they are wanted.

Expand Down

0 comments on commit dfe2fc7

Please sign in to comment.