Skip to content

Commit f3382b7

Browse files
committed
Fix input parameters
1 parent a67b03c commit f3382b7

File tree

18 files changed

+168
-37
lines changed

18 files changed

+168
-37
lines changed

.vscode/docs.code-snippets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"```",
5252
"",
5353
"```bash",
54-
"dsc config get --document ${1:name}.example.1.dsc.config.yaml",
54+
"dsc config get --file ${1:name}.example.1.dsc.config.yaml",
5555
"```",
5656
"",
5757
"```yaml",
@@ -110,7 +110,7 @@
110110
"```",
111111
"",
112112
"```bash",
113-
"dsc config get --document ${TM_FILENAME_BASE}.example.$1.dsc.config.yaml",
113+
"dsc config get --file ${TM_FILENAME_BASE}.example.$1.dsc.config.yaml",
114114
"```",
115115
"",
116116
"```yaml",

docs/reference/cli/config/set.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,22 @@ cat ./example.dsc.config.yaml | dsc config set --file -
8080

8181
<a id="example-2"></a>
8282

83-
The command uses the **path** option to enforce the configuration defined in the
83+
The command uses the **file** option to enforce the configuration defined in the
8484
`example.dsc.config.yaml` file.
8585

8686
```sh
87-
dsc config set --path ./example.dsc.config.yaml
87+
dsc config set --file ./example.dsc.config.yaml
8888
```
8989

9090
### Example 3 - Passing a configuration document as a variable
9191

9292
<a id="example-3"></a>
9393

94-
The command uses the **document** option to enforce the configuration stored in the `$desired`
94+
The command uses the **input** option to enforce the configuration stored in the `$desired`
9595
variable.
9696

9797
```sh
98-
dsc config set --document $desired
98+
dsc config set --input $desired
9999
```
100100

101101
## Options

docs/reference/cli/config/test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dsc config test [Options] --file <FILE>
2222
### Configuration document from option string
2323

2424
```sh
25-
dsc config test [Options] --document <INPUT>
25+
dsc config test [Options] --input <INPUT>
2626
```
2727

2828
### Configuration document from stdin

docs/reference/schemas/config/functions/add.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ resources:
3939
```
4040
4141
```bash
42-
dsc config get --document add.example.1.dsc.config.yaml
42+
dsc config get --file add.example.1.dsc.config.yaml
4343
```
4444

4545
```yaml
@@ -69,7 +69,7 @@ resources:
6969
```
7070

7171
```bash
72-
dsc config get --document add.example.2.dsc.config.yaml
72+
dsc config get --file add.example.2.dsc.config.yaml
7373
```
7474

7575
```yaml

docs/reference/schemas/config/functions/base64.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ resources:
4040
```
4141
4242
```bash
43-
dsc --input-file base64.example.1.dsc.config.yaml config get
43+
dsc --file base64.example.1.dsc.config.yaml config get
4444
```
4545

4646
```yaml
@@ -70,7 +70,7 @@ resources:
7070
```
7171

7272
```bash
73-
dsc --input-file base64.example.2.dsc.config.yaml config get
73+
dsc --file base64.example.2.dsc.config.yaml config get
7474
```
7575

7676
```yaml

docs/reference/schemas/config/functions/concat.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ resources:
4444
```
4545
4646
```bash
47-
dsc --input-file concat.example.1.dsc.config.yaml config get
47+
dsc config get --file concat.example.1.dsc.config.yaml
4848
```
4949

5050
```yaml
@@ -77,7 +77,7 @@ resources:
7777
```
7878

7979
```bash
80-
dsc config get --document concat.example.2.dsc.config.yaml
80+
dsc config get --file concat.example.2.dsc.config.yaml
8181
```
8282

8383
```yaml

docs/reference/schemas/config/functions/createArray.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ resources:
4242
```
4343
4444
```bash
45-
dsc config get --document createArray.example.1.dsc.config.yaml config get
45+
dsc config get --file createArray.example.1.dsc.config.yaml config get
4646
```
4747

4848
```yaml
@@ -75,7 +75,7 @@ resources:
7575
```
7676
7777
```bash
78-
dsc config get --document createArray.example.2.dsc.config.yaml
78+
dsc config get --file createArray.example.2.dsc.config.yaml
7979
```
8080

8181
```yaml
@@ -115,7 +115,7 @@ resources:
115115
```
116116
117117
```bash
118-
dsc config get --document createArray.example.3.dsc.config.yaml
118+
dsc config get --file createArray.example.3.dsc.config.yaml
119119
```
120120

121121
```yaml

docs/reference/schemas/config/functions/div.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ resources:
4141
```
4242
4343
```bash
44-
dsc config get --document div.example.1.dsc.config.yaml config get
44+
dsc config get --file div.example.1.dsc.config.yaml config get
4545
```
4646

4747
```yaml
@@ -72,7 +72,7 @@ resources:
7272
```
7373

7474
```bash
75-
dsc config get --document div.example.2.dsc.config.yaml
75+
dsc config get --file div.example.2.dsc.config.yaml
7676
```
7777

7878
```yaml
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
description: Reference for the 'format' DSC configuration document function
3+
ms.date: 02/28/2025
4+
ms.topic: reference
5+
title: format
6+
---
7+
8+
# format
9+
10+
## Synopsis
11+
12+
Returns a formatted string that uses placeholders to insert values.
13+
14+
## Syntax
15+
16+
```Syntax
17+
format(<formatString>, <arg1>, <arg2>, ...)
18+
```
19+
20+
## Description
21+
22+
The `format()` function returns a string that includes formatted values using a template and
23+
placeholders. Each placeholder in the template string is replaced with the corresponding argument
24+
value. Placeholders are specified with curly braces around the zero-based index of the argument.
25+
26+
## Examples
27+
28+
### Example 1 - Format a simple string
29+
30+
The configuration formats a string with two placeholders.
31+
32+
```yaml
33+
# format.example.1.dsc.config.yaml
34+
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
35+
resources:
36+
- name: Echo formatted string
37+
type: Microsoft.DSC.Debug/Echo
38+
properties:
39+
output: "[format('Hello, {0}! Today is {1}.', 'World', 'Monday')]"
40+
```
41+
42+
```bash
43+
dsc config get --file format.example.1.dsc.config.yaml
44+
```
45+
46+
```yaml
47+
results:
48+
- name: Echo formatted string
49+
type: Microsoft.DSC.Debug/Echo
50+
result:
51+
actualState:
52+
output: Hello, World! Today is Monday.
53+
messages: []
54+
hadErrors: false
55+
```
56+
57+
### Example 2 - Format a string with parameters
58+
59+
The configuration uses other functions within the `format()` function to build a dynamic message.
60+
61+
```yaml
62+
# format.example.2.dsc.config.yaml
63+
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
64+
parameters:
65+
username:
66+
type: string
67+
defaultValue: Mikey
68+
hour:
69+
type: string
70+
defaultValue: "09"
71+
minute:
72+
type: string
73+
defaultValue: "30"
74+
resources:
75+
- name: Echo dynamic formatted string
76+
type: Microsoft.DSC.Debug/Echo
77+
properties:
78+
output: "[format('Hello, {0}! The time is {1}:{2}.', parameters('username'), parameters('hour'), parameters('minute'))]"
79+
```
80+
81+
```bash
82+
dsc --file format.example.2.dsc.config.yaml config get
83+
```
84+
85+
```yaml
86+
results:
87+
- metadata:
88+
Microsoft.DSC:
89+
duration: PT0.0185508S
90+
name: Echo dynamic formatted string
91+
type: Microsoft.DSC.Debug/Echo
92+
result:
93+
actualState:
94+
output: Hello, Mikey! The time is 09:30.
95+
messages: []
96+
hadErrors: false
97+
```
98+
99+
## Parameters
100+
101+
### formatString
102+
103+
The `format()` function requires a template string that includes placeholders for argument values.
104+
Placeholders use the format `{n}`, where `n` is the zero-based index of the argument to insert.
105+
106+
```yaml
107+
Type: string
108+
Required: true
109+
MinimumCount: 1
110+
MaximumCount: 1
111+
```
112+
113+
### arguments
114+
115+
The function accepts one or more arguments of any type to insert into the formatted string.
116+
117+
```yaml
118+
Type: any
119+
Required: true
120+
MinimumCount: 1
121+
MaximumCount: unlimited
122+
```
123+
124+
## Output
125+
126+
The `format()` function returns a string where each placeholder in the **formatString** is replaced
127+
with the corresponding argument value.
128+
129+
```yaml
130+
Type: string
131+
```

docs/reference/schemas/config/functions/int.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ resources:
4040
```
4141
4242
```bash
43-
dsc config get --document int.example.1.dsc.config.yaml config get
43+
dsc config get --file int.example.1.dsc.config.yaml config get
4444
```
4545

4646
```yaml

0 commit comments

Comments
 (0)