Skip to content

Commit b9f1694

Browse files
committed
Add reference documentation for DSC function list
1 parent 79633e1 commit b9f1694

File tree

2 files changed

+214
-4
lines changed

2 files changed

+214
-4
lines changed

docs/reference/cli/function/index.md

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
---
2+
description: Command line reference for the 'dsc function list' command
3+
ms.date: 07/20/2025
4+
ms.topic: reference
5+
title: dsc function list
6+
---
7+
8+
# dsc function list
9+
10+
## Synopsis
11+
12+
List or find DSC functions.
13+
14+
## Syntax
15+
16+
```sh
17+
dsc function list [Options] [<FUNCTION_NAME>]
18+
```
19+
20+
## Description
21+
22+
The `dsc function list` command returns information about the available DSC functions. By default,
23+
it returns all available functions. You can filter the results by specifying a function name or
24+
pattern.
25+
26+
DSC functions are built-in functions that can be used in configuration documents to perform various
27+
operations including:
28+
29+
- String manipulation and formatting
30+
- Mathematical calculations
31+
- Logical operations
32+
- Type conversions
33+
- Parameter and variable access
34+
- Resource references
35+
36+
## Examples
37+
38+
### Example 1 - List all functions
39+
40+
This command returns information about all available DSC functions.
41+
42+
```sh
43+
dsc function list
44+
```
45+
46+
```output
47+
Category Function MinArgs MaxArgs ArgTypes Description
48+
------------------------------------------------------------------------------------------------------------------------------------------
49+
Array createArray 0 maxInt a-nso Creates an array from the given elements
50+
Comparison equals 2 2 a-nso Evaluates if the two values are the same
51+
Deployment parameters 1 1 ---s- Retrieves parameters from the configuration
52+
Deployment variables 1 1 ---s- Retrieves the value of a variable
53+
Logical and 2 maxInt -b--- Evaluates if all arguments are true
54+
Logical bool 1 1 --ns- Converts a string or number to a boolean
55+
Logical false 0 0 ----- Returns the boolean value false
56+
Logical if 3 3 abnso Evaluates a condition and returns second value if true, otherwise returns third value
57+
Logical not 1 1 -b--- Negates a boolean value
58+
Logical or 2 maxInt -b--- Evaluates if any arguments are true
59+
Logical true 0 0 ----- Returns the boolean value true
60+
Numeric add 2 2 --n-- Adds two or more numbers together
61+
Numeric div 2 2 --n-- Divides the first number by the second
62+
Numeric int 1 1 --ns- Converts a string or number to an integer
63+
Numeric max 1 maxInt a-n-- Returns the largest number from a list of numbers
64+
Numeric min 1 maxInt a-n-- Returns the smallest number from a list of numbers
65+
Numeric mod 2 2 --n-- Divides the first number by the second and returns the remainder
66+
Numeric mul 2 2 --n-- Multiplies two or more numbers together
67+
Numeric sub 2 2 --n-- Subtracts the second number from the first
68+
Resource reference 1 1 ---s- Retrieves the output of a previously executed resource
69+
Resource resourceId 2 2 ---s- Constructs a resource ID from the given type and name
70+
String base64 1 1 ---s- Encodes a string to Base64 format
71+
String concat 2 maxInt a--s- Concatenates two or more strings or arrays
72+
String format 2 maxInt -bns- Formats a string using the given arguments
73+
System envvar 1 1 ---s- Retrieves the value of an environment variable
74+
System path 2 maxInt ---s- Concatenates multiple strings into a file path
75+
System secret 1 2 ---s- Retrieves a secret from a vault
76+
System systemRoot 0 0 ---s- Returns the system root path
77+
```
78+
79+
### Example 2 - List functions with JSON output
80+
81+
This command returns function information in pretty JSON format.
82+
83+
```sh
84+
dsc function list --output-format pretty-json
85+
```
86+
87+
```json
88+
{
89+
"category": "Array",
90+
"name": "createArray",
91+
"description": "Creates an array from the given elements",
92+
"minArgs": 0,
93+
"maxArgs": 18446744073709551615,
94+
"acceptedArgTypes": [
95+
"String",
96+
"Number",
97+
"Object",
98+
"Array"
99+
]
100+
}
101+
{
102+
"category": "Comparison",
103+
"name": "equals",
104+
"description": "Evaluates if the two values are the same",
105+
"minArgs": 2,
106+
"maxArgs": 2,
107+
"acceptedArgTypes": [
108+
"Number",
109+
"String",
110+
"Array",
111+
"Object"
112+
]
113+
}
114+
// truncated
115+
```
116+
117+
### Example 3 - Filter functions by name
118+
119+
This command filters functions by name using a wildcard pattern.
120+
121+
```sh
122+
dsc function list "resource*"
123+
```
124+
125+
```output
126+
Category Name MinArgs MaxArgs ArgTypes Description
127+
-------- ---- ------- ------- -------- -----------
128+
Resource resourceId 2 2 ---s- Constructs a resource ID from the given type and name
129+
```
130+
131+
### Example 4 - Get details for a specific function
132+
133+
This command returns detailed information about a specific function.
134+
135+
```sh
136+
dsc function list "concat" --output-format json
137+
```
138+
139+
```json
140+
{"category":"String","name":"concat","description":"Concatenates two or more strings or arrays","minArgs":2,"maxArgs":18446744073709551615,"acceptedArgTypes":["String","Array"]}
141+
```
142+
143+
## Parameters
144+
145+
### FUNCTION_NAME
146+
147+
The name of the function to retrieve information about. You can use wildcard patterns to filter
148+
functions. When you specify this parameter, DSC only returns information about functions that match
149+
the pattern.
150+
151+
```yaml
152+
Type: string
153+
Required: false
154+
Position: 0
155+
```
156+
## Options
157+
### -o, --output-format
158+
<a id="-o"></a>
159+
<a id="--output-format"></a>
160+
Defines the output format for the command. By default, when run in an interactive terminal, the
161+
command outputs a human-readable table. When run non-interactively or when the output is
162+
redirected, the command outputs JSON.
163+
```yaml
164+
Type: string
165+
Mandatory: false
166+
DefaultValue: table (when interactive), json (when non-interactive)
167+
ValidValues: [json, pretty-json, yaml, table-no-truncate]
168+
LongSyntax: --output-format <FORMAT>
169+
ShortSyntax: -o <FORMAT>
170+
```
171+
### -h, --help
172+
<a id="-h"></a>
173+
<a id="--help"></a>
174+
Displays the help for the current command. When you specify this option, the application ignores
175+
all other options and arguments.
176+
```yaml
177+
Type : boolean
178+
Mandatory : false
179+
LongSyntax : --help
180+
ShortSyntax : -h
181+
```
182+
## Output
183+
The command returns information about DSC functions. The output includes:
184+
- **name** - The name of the function
185+
- **category** - The category the function belongs to (Logical, Numeric, String, Array, System, Resource)
186+
- **description** - A description of what the function does
187+
- **minArgs** - The minimum number of arguments the function accepts
188+
- **maxArgs** - The maximum number of arguments the function accepts
189+
- **acceptedArgTypes** - The types of arguments the function accepts
190+
### Argument Types
191+
The `acceptedArgTypes` field uses the following abbreviations in table format:
192+
193+
- **a** - Array
194+
- **b** - Boolean
195+
- **n** - Number
196+
- **o** - Object
197+
- **s** - String
198+
- **-** - No specific type (any type accepted)
199+
200+
When multiple types are accepted, multiple letters are shown. For example, `sn` means the function
201+
accepts both String and Number arguments.

docs/reference/cli/index.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ The `config` command manages a DSC Configuration document. You can use it to:
3434

3535
For more information, see [dsc config][02].
3636

37+
### function
38+
39+
The `function` command manages DSC functions. You can use it to:
40+
41+
- List the available functions with their descriptions and argument requirements.
42+
43+
For more information, see [dsc function][03]
44+
3745
### resource
3846

3947
The `resource` command manages a DSC Resource. You can use it to:
@@ -44,12 +52,12 @@ The `resource` command manages a DSC Resource. You can use it to:
4452
- Test whether a resource instance is in the desired state.
4553
- Set a resource instance to the desired state.
4654

47-
For more information, see [dsc resource][03]
55+
For more information, see [dsc resource][04]
4856

4957
### schema
5058

5159
The `schema` command returns the JSON schema for a specific DSC type. For more information, see
52-
[dsc schema][04].
60+
[dsc schema][05].
5361

5462
### help
5563

@@ -212,5 +220,6 @@ file, ensure that the input is encoded as UTF-8.
212220

213221
[01]: completer/index.md
214222
[02]: config/index.md
215-
[03]: resource/index.md
216-
[04]: schema/index.md
223+
[03]: function/index.md
224+
[04]: resource/index.md
225+
[05]: schema/index.md

0 commit comments

Comments
 (0)