Skip to content

Commit ae7e4f3

Browse files
committed
Rename flag to --no-formatting and update docs
Rename the flag from --no-format to --no-formatting to match the naming suggested in the PR #2502 discussion. Expand the help text and add a paragraph to the user manual.
1 parent 65db9c3 commit ae7e4f3

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

cli/src/convert.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ pub struct ConvertCommand {
3131
#[arg(short, long)]
3232
pub output: Option<PathBuf>,
3333

34-
/// Skip formatting the output
35-
#[arg(long)]
36-
pub no_format: bool,
34+
/// Skip formatting the output. Useful for batch conversions or when
35+
/// formatted output isn't needed.
36+
#[arg(long = "no-formatting")]
37+
pub no_formatting: bool,
3738
}
3839

3940
impl ConvertCommand {
@@ -119,7 +120,7 @@ impl ConvertCommand {
119120

120121
let nickel_string = {
121122
let unformatted = ast.to_string();
122-
if self.no_format {
123+
if self.no_formatting {
123124
unformatted
124125
} else {
125126
let mut output = Vec::new();

cli/tests/snapshot/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn check_conversion_no_format_snapshots(path: &str) {
109109
let file = TestFile::from_project_path(path);
110110
let invocation = NickelInvocation::new()
111111
.file(&file)
112-
.args(["convert", "--no-format"]);
112+
.args(["convert", "--no-formatting"]);
113113

114114
let (out, err) = invocation.snapshot();
115115
assert_snapshot_filtered!(file.prefixed_test_name("convert_no_format_stdout"), out);

doc/manual/cli.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,10 @@ Text files will be converted to Nickel strings: if `data.txt` contains the
399399
string `Hello, "world"` then `nickel convert data.txt` will output
400400
`"Hello, \"world\""`.
401401

402+
By default, the converted output is auto-formatted. Pass `--no-formatting` to
403+
skip the formatting step, which can be useful for batch conversions or when
404+
formatted output isn't needed.
405+
402406
The input type will be auto-detected based on the file extension. If you want to
403407
force the input type, supply the input on stdin and use the `--stdin-format` flag,
404408
like `cat data | nickel convert --stdin-format json`.

0 commit comments

Comments
 (0)