You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/bicep-cli.md
+12-21Lines changed: 12 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -140,17 +140,17 @@ This command converts a _params.bicepparam_ parameters file into a _params.json_
140
140
141
141
## console
142
142
143
-
The `console` command is available in Bicep CLI v0.42.1 or later. It provides an interactive Read-Eval-Print Loop (REPL) environment for Bicep expressions. It allows you to experiment with Bicep functions and expressions in an interactive console session. It supports the following features:
143
+
The `console` command is available in Bicep CLI v0.42.1 or later. It provides an interactive Read-Eval-Print Loop (REPL) environment for Bicep expressions. It allows you to experiment with Bicep functions and expressions in an interactive console session, especially useful when authoring or testing Bicep logic such as expressions, functions, and user-defined functions.. It supports the following features:
144
144
145
145
***Interactive Expression Evaluation**: Enter Bicep expressions and see their evaluated results immediately
146
-
***Variable Declarations**: Define variables using var name = expression syntax and reuse them in subsequent expressions
146
+
***Variable Declarations**: Define variables using `var name = expression syntax and reuse them in subsequent expressions
147
147
***Multi-line Input**: Support for complex multi-line expressions with automatic structural completion detection
148
148
***Syntax Highlighting**: Real-time syntax highlighting for input and output
149
149
150
150
The `console` command has these limitations:
151
151
152
-
* No support for expressions requiring Azure context, e.g. resourceGroup()
153
-
* No support for for-loop expressions, e.g. [for i in range(0, x): i]
152
+
* No support for expressions requiring Azure context, e.g. `resourceGroup()`
153
+
* No support for for-loop expressions, e.g. `[for i in range(0, x): i]`
154
154
* No persistent state between console sessions
155
155
* No completions support
156
156
@@ -172,19 +172,6 @@ To exit the console, press `ESC` or use the `exit` command.
172
172
173
173
### Examples
174
174
175
-
#### Simple Expressions
176
-
```bicep
177
-
> 1 + 2
178
-
3
179
-
180
-
> 'Hello, ' + 'World!'
181
-
'Hello, World!'
182
-
183
-
> length(['a', 'b', 'c'])
184
-
3
185
-
186
-
```
187
-
188
175
#### Simple Expressions
189
176
190
177
```bicep
@@ -266,9 +253,9 @@ true
266
253
267
254
#### Loading content from files
268
255
269
-
Bicep console also supports the [`load*()` functions](./bicep-functions-files.md#file-functions-for-bicep). Note: The directory from which the `bicep console` command is run is used as the _current directory_ when evaluating the `load*()` functions
256
+
Bicep console also supports the [`load*()` functions](./bicep-functions-files.md#file-functions-for-bicep). The directory from which the `bicep console` command is run is used as the _current directory_ when evaluating the `load*()` functions
270
257
271
-
The following example shows how to use `loadDirectoryFileInfo()` to load information about all Bicep files in a directory:
258
+
The following example shows how to use [`loadDirectoryFileInfo()`](./bicep-functions-files.md#loaddirectoryfileinfo) to load information about all Bicep files in a directory:
272
259
273
260
```bicep
274
261
> loadDirectoryFileInfo('./modules/', '*.bicep')
@@ -283,7 +270,11 @@ The following example shows how to use `loadDirectoryFileInfo()` to load informa
283
270
284
271
#### Piping and standard input/output redirection
285
272
286
-
The console command supports evaluating expressions provided through piping or redirected standard input, i.e.:
273
+
The console command supports evaluating expressions provided through piping or redirected standard input, enabling scenarios like:
274
+
275
+
* Passing expression text via echo
276
+
* Composing scripts that feed expressions into the console
277
+
* Rapid testing of generated or transformed Bicep snippets
0 commit comments