Azure / Azure/bicep

Bicep CLI - Implement `--help` per command

Open
#14,187 0 comments 2 reactions 0 assignees View on GitHub
enhancement Needs: Upvote
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 4h
Merged PRs (30d)
81

Description

**Is your feature request related to a problem? Please describe.**

* The output of `bicep --help` is gigantic and hard to navigate in a terminal.
* Bicep CLI does not support help per command, like `bicep --help` for instance.

Current output of v0.27.1:

Click to expand

```
Bicep CLI version 0.27.1 (4b41cb6d4b)

Usage:
bicep build [options]
Builds a .bicep file.

Arguments:
The input file

Options:
--outdir Saves the output at the specified directory.
--outfile Saves the output as the specified file path.
--stdout Prints the output to stdout.
--no-restore Builds the bicep file without restoring external modules.
--diagnostics-format Sets the format with which diagnostics are displayed. Valid values are ( Default | Sarif ).

Examples:
bicep build file.bicep
bicep build file.bicep --stdout
bicep build file.bicep --outdir dir1
bicep build file.bicep --outfile file.json
bicep build file.bicep --no-restore
bicep build file.bicep --diagnostics-format sarif

bicep format [options]
Formats a .bicep file.

Arguments:
The input file

Options:
--outdir Saves the output at the specified directory.
--outfile Saves the output as the specified file path.
--stdout Prints the output to stdout.
--newline Set newline char. Valid values are ( Auto | LF | CRLF | CR ).
--indent-kind Set indentation kind. Valid values are ( Space | Tab ).
--indent-size Number of spaces to indent with (Only valid with --indentKind set to Space).
--insert-final-newline Insert a final newline.

Examples:
bicep format file.bicep
bicep format file.bicep --stdout
bicep format file.bicep --outdir dir1
bicep format file.bicep --outfile file.json
bicep format file.bicep --indent-kind Tab

bicep decompile [options]
Attempts to decompile a template .json file to .bicep.

Arguments:
The input file

Options:
--outdir Saves the output at the specified directory.
--outfile Saves the output as the specified file path.
--stdout Prints the output to stdout.
--force Allows overwriting the output file if it exists (applies only to 'bicep decompile' or 'bicep decompile-params').

Examples:
bicep decompile file.json
bicep decompile file.json --stdout
bicep decompile file.json --outdir dir1
bicep decompile file.json --force
bicep decompile file.json --outfile file.bicep

bicep lint [options]
Lints a .bicep file.

Arguments:
The input file

Options:
--no-restore Skips restoring external modules.
--diagnostics-format Sets the format with which diagnostics are displayed. Valid values are ( Default | Sarif ).

Examples:
bicep lint file.bicep
bicep lint file.bicep --no-restore
bicep lint file.bicep --diagnostics-format sarif

bicep decompile-params [options]
Attempts to decompile a parameters .json file to .bicepparam.

Arguments:
The input file

Options:
--outdir Saves the output at the specified directory.
--outfile Saves the output as the specified file path.
--stdout Prints the output to stdout.
--force Allows overwriting the output file if it exists (applies only to 'bicep decompile' or 'bicep decompile-params').
--bicep-file Path to the bicep template file that will be referenced in the using declaration

Examples:
bicep decompile-params file.json
bicep decompile-params file.json --bicep-file ./dir/main.bicep
bicep decompile-params file.json --stdout
bicep decompile-params file.json --outdir dir1
bicep decompile-params file.json --force
bicep decompile-params file.json --outfile file.bicepparam

bicep generate-params [options]
Builds parameters file from the given bicep file, updates if there is an existing parameters file.

Arguments:
The input file

Options:
--no-restore Generates the parameters file without restoring external modules.
--outdir Saves the output at the specified directory.
--outfile Saves the output as the specified file path.
--stdout Prints the output to stdout.
--output-format Selects the output format {json, bicepparam}
--include-params Selects which parameters to include into output {requiredonly, all}

Examples:
bicep generate-params file.bicep
bicep generate-params file.bicep --no-restore
bicep generate-params file.bicep --stdout
bicep generate-params file.bicep --outdir dir1
bicep generate-params file.bicep --outfile file.parameters.json
bicep generate-params file.bicep --output-format bicepparam --include-params all

bicep publish --target
Publishes the .bicep file to the module registry.

Arguments:
The input file (can be a Bicep file or an ARM template file)
The module reference

Options:
--documentation-uri Module documentation uri
--with-source [Experimental] Publish source code with the module
--force Overwrite existing published module or file

Examples:
bicep publish file.bicep --target br:example.azurecr.io/hello/world:v1
bicep publish file.bicep --target br:example.azurecr.io/hello/world:v1 --force
bicep publish file.bicep --target br:example.azurecr.io/hello/world:v1 --documentation-uri https://github.com/hello-world/README.md --with-source
bicep publish file.json --target br:example.azurecr.io/hello/world:v1 --documentation-uri https://github.com/hello-world/README.md

bicep restore
Restores external modules from the specified Bicep file to the local module cache.

Arguments:
The input file

bicep [options]
Options:
--version -v Shows bicep version information
--help -h Shows this usage information
--license Prints license information
--third-party-notices Prints third-party notices

bicep build-params
Builds a .json file from a .bicepparam file.

Arguments:
The input Bicepparam file

Options:
--bicep-file Verifies if the specified bicep file path matches the one provided in the params file using declaration
--outfile Saves the param output json as the specified file path.
--stdout Prints the param and bicep json output to stdout.
--no-restore Builds the bicep file (referenced in using declaration) without restoring external modules.
--diagnostics-format Sets the format with which diagnostics are displayed. Valid values are ( Default | Sarif ).

Examples:
bicep build-params params.bicepparam
bicep build-params params.bicepparam --stdout
bicep build-params params.bicepparam --outfile otherParams.json
bicep build-params params.bicepparam --no-restore
bicep build-params params.bicepparam --diagnostics-format sarif
```

**Describe the solution you'd like**

Add ability to do `bicep --help` or `bicep --help `.

* Example: `bicep build --help` or `bicep --help build`

Contributor guide

Open the contributing guide

Research direction

Start by running the existing `bicep --help` output and inspect how the listed commands are dispatched. Add command-specific help for forms such as `bicep build --help` and `bicep --help build`, then verify that each listed command displays focused usage information without changing normal command behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cli
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.