Command-line usage
The Rust crate for Ardent consists of two parts: the library for use in other Rust projects and the CLI tool. On this page you’ll learn how to use ardent on the command-line.
Commands
Section titled “Commands”Once you’ve completed the installation, Ardent should be available in your shell. Running ardent without extra arguments will print available sub-commands and flags:
🍁 Ardent is an opinionated code formatter for NSIS scripts
Usage: ardent [OPTIONS] [COMMAND]
Commands: format Command to format NSIS scripts check Command to check if NSIS scripts are formatted correctly help Print this message or the help of the given subcommand(s)
Options: -D, --debug Print debug messages --completions <SHELL> Print a shell completion script -h, --help Print help -V, --version Print versionformat
Section titled “format”The format sub-command allows the formatting of NSIS scripts. By default, the output is printed to stdout. You may use the --write flag to apply the formatting changes in-place.
See ardent format --help for a list of all options.
The check sub-command will report whether an NSIS script requires formatting. Using the --write flag will apply the changes in-place, while the --diff flag will visualize the formatting changes.
See ardent check --help for a list of all options.
--completions
Section titled “--completions”The --completions flag prints a shell completion script to stdout, so that pressing Tab offers Ardent’s sub-commands and flags. It accepts bash, elvish, fish, powershell or zsh.
Ardent only prints the script — where it belongs is up to your shell, so redirect it accordingly.
Powershell
New-Item -ItemType File -Path $PROFILE -Force | Out-Nullardent --completions powershell | Out-File -Append -Encoding utf8 $PROFILEBash
# bash, which requires bash-completion to be installedardent --completions bash > ~/.local/share/bash-completion/completions/ardentFish
# fish, which needs no further setupardent --completions fish > ~/.config/fish/completions/ardent.fishStart a new shell session for any of the above to take effect.
Options
Section titled “Options”Control how line-breaks are represented. Ardent follows the operating system defaults – CRLF on Windows and LF elsewhere. Accepts crlf or lf.
--indent-size
Section titled “--indent-size”Number of units per indentation level. Defaults to 2.
--use-spaces
Section titled “--use-spaces”Ardent encourages the use of tabs. While there are often pseudo-religious reasons for choosing tabs or spaces, we prefer tabs for a single practical reason: tabs are preferred by visually impaired programmers, so tabs provide better accessibility. However, you may override it using this flag.
--single-quote
Section titled “--single-quote”Prefer single quotes instead of double quotes.
--comment-style
Section titled “--comment-style”Specify whether you want to unify comment markers to # or ;. Block comments are never touched. Accepts hash or semi.
--no-trim
Section titled “--no-trim”Ardent will collapse multiple empty lines. Using this flag will prevent this.
--print-width
Section titled “--print-width”Ardent uses a print width of 120 characters. This flag allows changing the default value. Setting it to 0 will disable it.