Skip to content

Add --format to subcommands #227

@michaeltlombardi

Description

@michaeltlombardi

Summary of the new feature / enhancement

Currently, to define a format for the output, a user needs to add the --format / -f option after the root command and before any subcommands, like:

dsc --format pretty-json resource test -r Microsoft/OSInfo -i '{ "bitness": "64" }'

We should make it possible for users to define the format option on the subcommands as well or instead, so they follow a semantic of selecting the command to use, then supplying options for it:

dsc resource test -r Microsoft/OSInfo -i '{ "bitness": "64" }' -f pretty-json

Note

Additionally, --format doesn't apply to the dsc completer command.

Proposed technical implementation details (optional)

  1. Define --format as a reusable option and add it to the final-leaf subcommands where it applies. For example, the option should be added to dsc config set but not dsc config.
  2. (Optional) Remove the global option, or make dsc completer error when the global option is specified.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions