Skip to content

Commit 7acdaf4

Browse files
committed
edit
1 parent 1d7dae1 commit 7acdaf4

1 file changed

Lines changed: 12 additions & 21 deletions

File tree

articles/azure-resource-manager/bicep/bicep-cli.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,17 @@ This command converts a _params.bicepparam_ parameters file into a _params.json_
140140

141141
## console
142142

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:
144144

145145
* **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
147147
* **Multi-line Input**: Support for complex multi-line expressions with automatic structural completion detection
148148
* **Syntax Highlighting**: Real-time syntax highlighting for input and output
149149

150150
The `console` command has these limitations:
151151

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]`
154154
* No persistent state between console sessions
155155
* No completions support
156156

@@ -172,19 +172,6 @@ To exit the console, press `ESC` or use the `exit` command.
172172

173173
### Examples
174174

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-
188175
#### Simple Expressions
189176

190177
```bicep
@@ -266,9 +253,9 @@ true
266253

267254
#### Loading content from files
268255

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
270257

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:
272259

273260
```bicep
274261
> loadDirectoryFileInfo('./modules/', '*.bicep')
@@ -283,7 +270,11 @@ The following example shows how to use `loadDirectoryFileInfo()` to load informa
283270

284271
#### Piping and standard input/output redirection
285272

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
287278

288279
**Powershell**:
289280

@@ -301,7 +292,7 @@ echo "parseCidr('10.144.0.0/20')" | bicep console
301292
bicep console < test.txt
302293
```
303294

304-
Multi-line input is also supported, i.e:
295+
Multi-line input is also supported:
305296

306297
```powershell
307298
"{

0 commit comments

Comments
 (0)