Skip to content

Commit 21dcecc

Browse files
(DOCS) Update docs for input options
This change updates the CLI reference and changelog to reflect the refactored options for input to the `config` and `resource` subcommands.
1 parent 7c95ac5 commit 21dcecc

File tree

9 files changed

+430
-104
lines changed

9 files changed

+430
-104
lines changed

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ changes since the last release, see the [diff on GitHub][unreleased].
2828

2929
- Updated the options for the `dsc` root command:
3030

31-
- Removed the global [--format][36] option, which controls the output format. Now, the relevant
31+
- Removed the global `--format` option, which controls the output format. Now, the relevant
3232
subcommands that return formattable output have the `--format` option (short option as `-f`)
3333
added to them.
34+
- Removed the global `--input` and `--input-file` options. Now, the `config` subcommands have the
35+
`--document` and `--path` options for specifying the configuration document as a string or from
36+
a file. The relevant `resource` subcommands have the `--input` and `--path` options for
37+
specifying the instance properties as a string or from a file.
3438
- The `--logging-level` option is renamed to [--trace-level][37] with the short name `-l`. The
3539
default trace level is now `warning` instead of `info`.
3640
- Added the [--trace-format][38] option with the `-f` short name. This option enables you to
@@ -43,9 +47,11 @@ changes since the last release, see the [diff on GitHub][unreleased].
4347
- Issues:
4448
- [#286][#286]
4549
- [#227][#227]
50+
- [#226][#226]
4651
- PRs:
4752
- [#299][#299]
4853
- [#303][#303]
54+
- [#305][#305]
4955

5056
</details>
5157

@@ -558,6 +564,7 @@ For the full list of changes in this release, see the [diff on GitHub][compare-v
558564
[#215]: https://github.com/PowerShell/DSC/issues/215
559565
[#216]: https://github.com/PowerShell/DSC/issues/216
560566
[#217]: https://github.com/PowerShell/DSC/issues/217
567+
[#226]: https://github.com/PowerShell/DSC/issues/226
561568
[#227]: https://github.com/PowerShell/DSC/issues/227
562569
[#240]: https://github.com/PowerShell/DSC/issues/240
563570
[#241]: https://github.com/PowerShell/DSC/issues/241
@@ -568,6 +575,7 @@ For the full list of changes in this release, see the [diff on GitHub][compare-v
568575
[#294]: https://github.com/PowerShell/DSC/issues/294
569576
[#299]: https://github.com/PowerShell/DSC/issues/299
570577
[#303]: https://github.com/PowerShell/DSC/issues/303
578+
[#305]: https://github.com/PowerShell/DSC/issues/305
571579
[#45]: https://github.com/PowerShell/DSC/issues/45
572580
[#49]: https://github.com/PowerShell/DSC/issues/49
573581
[#57]: https://github.com/PowerShell/DSC/issues/57

docs/reference/cli/config/export.md

+54-6
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,36 @@ Generates a configuration document that defines the existing instances of a set
1313

1414
## Syntax
1515

16+
### Configuration document from stdin
17+
1618
```sh
17-
dsc config export [Options]
19+
<document-string> | dsc config export [Options]
20+
```
21+
22+
### Configuration document from option string
23+
24+
```sh
25+
dsc config export [Options] --document <document-string>
26+
```
27+
28+
### Configuration document from file
29+
30+
```sh
31+
dsc config export [Options] --path <document-filepath>
1832
```
1933

2034
## Description
2135

2236
The `export` subcommand generates a configuration document that includes every instance of a set of
23-
resources. This command expects a configuration document formatted as JSON or YAML over stdin. The
24-
input configuration defines the resources to export. DSC ignores any properties specified for the
25-
resources in the input configuration for the operation, but the input document and any properties
26-
for resource instances must still validate against the configuration document and resource instance
27-
schemas.
37+
resources.
38+
39+
The configuration document must be passed to this command as JSON or YAML over stdin, as a string
40+
with the **document** option, or from a file with the **path** option.
41+
42+
The input configuration defines the resources to export. DSC ignores any properties specified for
43+
the resources in the input configuration for the operation, but the input document and any
44+
properties for resource instances must still validate against the configuration document and
45+
resource instance schemas.
2846

2947
Only specify resources with a resource manifest that defines the [export][01] section in the input
3048
configuration. Only define each resource type once. If the configuration document includes any
@@ -33,6 +51,36 @@ configuration, DSC raises an error.
3351

3452
## Options
3553

54+
### -d, --document
55+
56+
Specifies the configuration document to export from as a JSON or YAML object. DSC validates the
57+
document against the configuration document schema. If the validation fails, DSC raises an error.
58+
59+
This option can't be used with configuration document over stdin or the `--path` option. Choose
60+
whether to pass the configuration document to the command over stdin, from a file with the `--path`
61+
option, or with the `--document` option.
62+
63+
```yaml
64+
Type: String
65+
Mandatory: false
66+
```
67+
68+
### -p, --path
69+
70+
Defines the path to a configuration document to export instead of piping the document from stdin or
71+
passing it as a string with the `--document` option. The specified file must contain a
72+
configuration document as a JSON or YAML object. DSC validates the document against the
73+
configuration document schema. If the validation fails, or if the specified file doesn't exist, DSC
74+
raises an error.
75+
76+
This option is mutually exclusive with the `--document` option. When you use this option, DSC
77+
ignores any input from stdin.
78+
79+
```yaml
80+
Type: String
81+
Mandatory: false
82+
```
83+
3684
### -f, --format
3785

3886
The `--format` option controls the console output format for the command. If the command output is

docs/reference/cli/config/get.md

+55-11
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,22 @@ Retrieves the current state of resource instances in a configuration document.
1313

1414
## Syntax
1515

16+
### Configuration document from stdin
17+
18+
```sh
19+
<document-string> | dsc config get [Options]
20+
```
21+
22+
### Configuration document from option string
23+
24+
```sh
25+
dsc config get [Options] --document <document-string>
26+
```
27+
28+
### Configuration document from file
29+
1630
```sh
17-
dsc config get [Options]
31+
dsc config get [Options] --path <document-filepath>
1832
```
1933

2034
## Description
@@ -23,7 +37,8 @@ The `get` subcommand returns the current state of the resource instances in a co
2337
document. When this command runs, DSC validates the configuration document before invoking the get
2438
operation for each resource instance defined in the document.
2539

26-
The configuration document must be passed to this command as JSON or YAML over stdin.
40+
The configuration document must be passed to this command as JSON or YAML over stdin, as a string
41+
with the **document** option, or from a file with the **path** option.
2742

2843
## Examples
2944

@@ -60,24 +75,55 @@ cat ./example.dsc.config.yaml | dsc config get
6075

6176
### Example 2 - Passing a file to read as the configuration document
6277

63-
The command uses the [--input-file][01] global option to retrieve the resource instances defined in
64-
the `example.dsc.config.yaml` file.
78+
The command uses the **path** option to retrieve the resource instances defined in the
79+
`example.dsc.config.yaml` file.
6580

6681
```sh
67-
dsc --input-file ./example.dsc.config.yaml config get
82+
dsc config get --path ./example.dsc.config.yaml
6883
```
6984

7085
### Example 3 - Passing a configuration document as a variable
7186

72-
The command uses the [--input][02] global option to retrieve the resource instances defined in a
87+
The command uses the **document** option to retrieve the resource instances defined in a
7388
configuration document stored in the `$desired` variable.
7489

7590
```sh
76-
dsc --input $desired config get
91+
dsc config get --document $desired
7792
```
7893

7994
## Options
8095

96+
### -d, --document
97+
98+
Specifies the configuration document to retrieve actual state for. The document must be a string
99+
containing a JSON or YAML object. DSC validates the document against the configuration document
100+
schema. If the validation fails, DSC raises an error.
101+
102+
This option can't be used with configuration document over stdin or the `--path` option. Choose
103+
whether to pass the configuration document to the command over stdin, from a file with the `--path`
104+
option, or with the `--document` option.
105+
106+
```yaml
107+
Type: String
108+
Mandatory: false
109+
```
110+
111+
### -p, --path
112+
113+
Defines the path to a configuration document to retrieve actual state for instead of piping the
114+
document from stdin or passing it as a string with the `--document` option. The specified file must
115+
contain a configuration document as a JSON or YAML object. DSC validates the document against the
116+
configuration document schema. If the validation fails, or if the specified file doesn't exist, DSC
117+
raises an error.
118+
119+
This option is mutually exclusive with the `--document` option. When you use this option, DSC
120+
ignores any input from stdin.
121+
122+
```yaml
123+
Type: String
124+
Mandatory: false
125+
```
126+
81127
### -f, --format
82128

83129
The `--format` option controls the console output format for the command. If the command output is
@@ -104,8 +150,6 @@ Mandatory: false
104150

105151
This command returns JSON output that includes whether the operation or any resources raised any
106152
errors, the collection of messages emitted during the operation, and the get operation results for
107-
every instance. For more information, see [dsc config get result schema][03].
153+
every instance. For more information, see [dsc config get result schema][01].
108154

109-
[01]: ../dsc.md#-p---input-file
110-
[02]: ../dsc.md#-i---input
111-
[03]: ../../schemas/outputs/config/get.md
155+
[01]: ../../schemas/outputs/config/get.md

docs/reference/cli/config/set.md

+56-12
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,22 @@ Enforces the desired state of resource instances in a configuration document.
1313

1414
## Syntax
1515

16+
### Configuration document from stdin
17+
18+
```sh
19+
<document-string> | dsc config set [Options]
20+
```
21+
22+
### Configuration document from option string
23+
24+
```sh
25+
dsc config set [Options] --document <document-string>
26+
```
27+
28+
### Configuration document from file
29+
1630
```sh
17-
dsc config set [Options]
31+
dsc config set [Options] --path <document-filepath>
1832
```
1933

2034
## Description
@@ -24,7 +38,8 @@ document. When this command runs, DSC validates the configuration document befor
2438
operation for each resource instance defined in the document. DSC then invokes the set operation
2539
for each resource instance that isn't in the desired state.
2640

27-
The configuration document must be passed to this command as JSON or YAML over stdin.
41+
The configuration document must be passed to this command as JSON or YAML over stdin, as a string
42+
with the **document** option, or from a file with the **path** option.
2843

2944
## Examples
3045

@@ -61,24 +76,55 @@ cat ./example.dsc.config.yaml | dsc config set
6176

6277
### Example 2 - Passing a file to read as the configuration document
6378

64-
The command uses the [--input-file][01] global option to enforce the configuration defined in
65-
the `example.dsc.config.yaml` file.
79+
The command uses the **path** option to enforce the configuration defined in the
80+
`example.dsc.config.yaml` file.
6681

6782
```sh
68-
dsc --input-file ./example.dsc.config.yaml config set
83+
dsc config set --path ./example.dsc.config.yaml
6984
```
7085

7186
### Example 3 - Passing a configuration document as a variable
7287

73-
The command uses the [--input][02] global option to enforce the configuration stored in the
74-
`$desired` variable.
88+
The command uses the **document** option to enforce the configuration stored in the `$desired`
89+
variable.
7590

7691
```sh
77-
dsc --input $desired config set
92+
dsc config set --document $desired
7893
```
7994

8095
## Options
8196

97+
### -d, --document
98+
99+
Specifies the configuration document to enforce state for. The document must be a string
100+
containing a JSON or YAML object. DSC validates the document against the configuration document
101+
schema. If the validation fails, DSC raises an error.
102+
103+
This option can't be used with configuration document over stdin or the `--path` option. Choose
104+
whether to pass the configuration document to the command over stdin, from a file with the `--path`
105+
option, or with the `--document` option.
106+
107+
```yaml
108+
Type: String
109+
Mandatory: false
110+
```
111+
112+
### -p, --path
113+
114+
Defines the path to a configuration document to enforce state for instead of piping the document
115+
from stdin or passing it as a string with the `--document` option. The specified file must contain
116+
a configuration document as a JSON or YAML object. DSC validates the document against the
117+
configuration document schema. If the validation fails, or if the specified file doesn't exist, DSC
118+
raises an error.
119+
120+
This option is mutually exclusive with the `--document` option. When you use this option, DSC
121+
ignores any input from stdin.
122+
123+
```yaml
124+
Type: String
125+
Mandatory: false
126+
```
127+
82128
### -f, --format
83129

84130
The `--format` option controls the console output format for the command. If the command output is
@@ -105,8 +151,6 @@ Mandatory: false
105151

106152
This command returns JSON output that includes whether the operation or any resources raised any
107153
errors, the collection of messages emitted during the operation, and the set operation results for
108-
every instance. For more information, see [dsc config get result schema][03].
154+
every instance. For more information, see [dsc config get result schema][01].
109155

110-
[01]: ../dsc.md#-p---input-file
111-
[02]: ../dsc.md#-i---input
112-
[03]: ../../schemas/outputs/config/set.md
156+
[01]: ../../schemas/outputs/config/set.md

0 commit comments

Comments
 (0)