File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff 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
3940impl 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 ( ) ;
Original file line number Diff line number Diff 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) ;
Original file line number Diff line number Diff line change @@ -399,6 +399,10 @@ Text files will be converted to Nickel strings: if `data.txt` contains the
399399string ` 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+
402406The input type will be auto-detected based on the file extension. If you want to
403407force the input type, supply the input on stdin and use the ` --stdin-format ` flag,
404408like ` cat data | nickel convert --stdin-format json ` .
You can’t perform that action at this time.
0 commit comments