Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --input and --input-file to dsc #217

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

SteveL-MSFT
Copy link
Member

PR Summary

Add -i | --input and -p | --input-file as ways to pass input to dsc instead of just via stdin. The two parameters are mutually exclusive. Currently, stdin is ignored if either of these parameters are used.

PR Context

Fix #130

@michaeltlombardi
Copy link
Collaborator

michaeltlombardi commented Oct 4, 2023

Non-blocking, but we may want to have a think about the UX for global options—currently, if I want to use both the format and input options, I have to run a command like:

dsc -f pretty-json -i $desired resource test -r Example.Go/TSToy

This isn't very ergonomic, esp since these options are provided before two layers of subcommands. From my perspective, this would be the more natural command:

dsc resource test -f pretty-json -r Example.Go/TSToy -i $desired

Is it possible to define option flags on the subcommands that override/define the globals for convenience? I haven't delved too deeply into clap, but in cobra you can define persistent options that work this way (define once, available on all child commands).

@SteveL-MSFT
Copy link
Member Author

@michaeltlombardi let's cover that topic as part of the cmdline review meeting

Copy link
Contributor

@miroman9364 miroman9364 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should review some of the argument names we are using and compare how they match up against pre-existing tools. However, I think we need this functionality and we can always change the names later.

@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Oct 4, 2023
Merged via the queue into PowerShell:main with commit 67ade07 Oct 4, 2023
4 checks passed
@SteveL-MSFT SteveL-MSFT deleted the dsc-input branch October 4, 2023 22:41
michaeltlombardi added a commit to michaeltlombardi/DSC that referenced this pull request Oct 5, 2023
This change updates the project changelog, reference documentation, and
schemas for the recent PRs merged for the project:

- PowerShell#206
- PowerShell#208
- PowerShell#211
- PowerShell#213
- PowerShell#215
- PowerShell#216
- PowerShell#217

The updates include:

- Documenting the new `_exist` property, replacing `_ensure` for
  resources. This documentation update includes the schema definition,
  but doesn't regenerate the schema, which will be handled separately.
- Documenting the new `completer` command.
- Documenting the new `--input` and `--input-file` global options.
- Adding a deprecation notice to the `_ensure` documentation.
- Adding entries for all user-impacting changes to the changelog.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support a --file option for dsc config * commands
3 participants