@@ -18,7 +18,6 @@ mod output;
1818mod output_test;
1919mod ps;
2020mod ps_newfmt;
21- mod ps_oldfmt;
2221#[ cfg( test) ]
2322mod ps_test;
2423mod slurmjobs;
@@ -77,9 +76,6 @@ enum Commands {
7776 /// the per-cpu usage since boot.
7877 load : bool ,
7978
80- /// Output old CSV, not new JSON
81- csv : bool ,
82-
8379 /// Cluster name
8480 cluster : Option < String > ,
8581 } ,
@@ -90,12 +86,6 @@ enum Commands {
9086 } ,
9187 /// Extract node information
9288 Sysinfo {
93- /// Output CSV, not old JSON
94- csv : bool ,
95-
96- /// Output old JSON, not new JSON
97- oldjson : bool ,
98-
9989 /// Cluster name
10090 cluster : Option < String > ,
10191
@@ -116,9 +106,6 @@ enum Commands {
116106 /// to is exclusive. Precludes -window.
117107 span : Option < String > ,
118108
119- /// Output old CSV, not new JSON
120- csv : bool ,
121-
122109 /// Include PENDING and RUNNING jobs
123110 deluge : bool ,
124111
@@ -169,7 +156,6 @@ fn main() {
169156 exclude_commands,
170157 lockdir,
171158 load,
172- csv,
173159 cluster,
174160 } => {
175161 let opts = ps:: PsOptions {
@@ -190,11 +176,7 @@ fn main() {
190176 vec ! [ ]
191177 } ,
192178 lockdir : lockdir. clone ( ) ,
193- fmt : if * csv {
194- ps:: Format :: CSV
195- } else {
196- ps:: Format :: NewJSON
197- } ,
179+ fmt : ps:: Format :: JSON ,
198180 cpu_util : true ,
199181 token,
200182 } ;
@@ -212,8 +194,6 @@ fn main() {
212194 ) ;
213195 }
214196 Commands :: Sysinfo {
215- csv,
216- oldjson,
217197 cluster,
218198 topo_svg_cmd,
219199 topo_text_cmd,
@@ -227,21 +207,14 @@ fn main() {
227207 writer,
228208 & system. freeze ( ) . expect ( "System initialization" ) ,
229209 token,
230- if * csv {
231- sysinfo:: Format :: CSV
232- } else if * oldjson {
233- sysinfo:: Format :: OldJSON
234- } else {
235- sysinfo:: Format :: NewJSON
236- } ,
210+ sysinfo:: Format :: JSON ,
237211 topo_svg_cmd. clone ( ) ,
238212 topo_text_cmd. clone ( ) ,
239213 ) ;
240214 }
241215 Commands :: Slurmjobs {
242216 window,
243217 span,
244- csv,
245218 deluge,
246219 batch_size,
247220 cluster,
@@ -259,11 +232,7 @@ fn main() {
259232 * batch_size,
260233 & system. freeze ( ) . expect ( "System initialization" ) ,
261234 token,
262- if * csv {
263- slurmjobs:: Format :: CSV
264- } else {
265- slurmjobs:: Format :: NewJSON
266- } ,
235+ slurmjobs:: Format :: JSON ,
267236 ) ;
268237 }
269238 Commands :: Cluster { cluster } => {
@@ -288,10 +257,7 @@ fn main() {
288257// For the sake of simplicity:
289258// - allow repeated options to overwrite earlier values
290259// - all error reporting is via a generic "usage" message, without specificity as to what was wrong
291- // - both --json and --csv are accepted to all commands
292- //
293- // Note that --json means "new json" everywhere, so --json for `sonar sysinfo` changes the output
294- // format from the default old JSON encoding.
260+ // - --json does nothing, while --csv and --oldfmt cause errors
295261
296262fn command_line ( ) -> Commands {
297263 let args = std:: env:: args ( ) . collect :: < Vec < String > > ( ) ;
@@ -322,8 +288,6 @@ fn command_line() -> Commands {
322288 let mut exclude_commands = None ;
323289 let mut lockdir = None ;
324290 let mut load = false ;
325- let mut json = false ;
326- let mut csv = false ;
327291 let mut cluster = None ;
328292 while next < args. len ( ) {
329293 let arg = args[ next] . as_ref ( ) ;
@@ -336,11 +300,7 @@ fn command_line() -> Commands {
336300 } else if let Some ( new_next) = bool_arg ( arg, & args, next, "--load" ) {
337301 ( next, load) = ( new_next, true ) ;
338302 } else if let Some ( new_next) = bool_arg ( arg, & args, next, "--json" ) {
339- ( next, json) = ( new_next, true ) ;
340- } else if let Some ( new_next) = bool_arg ( arg, & args, next, "--csv" ) {
341- ( next, csv) = ( new_next, true ) ;
342- } else if let Some ( new_next) = bool_arg ( arg, & args, next, "--oldfmt" ) {
343- ( next, csv) = ( new_next, true ) ;
303+ next = new_next;
344304 } else if let Some ( new_next) =
345305 bool_arg ( arg, & args, next, "--exclude-system-jobs" )
346306 {
@@ -377,10 +337,6 @@ fn command_line() -> Commands {
377337 usage ( true ) ;
378338 }
379339 }
380- if json && csv {
381- eprintln ! ( "--csv and --json are incompatible" ) ;
382- std:: process:: exit ( USAGE_ERROR ) ;
383- }
384340 Commands :: PS {
385341 rollup,
386342 min_cpu_percent,
@@ -391,26 +347,18 @@ fn command_line() -> Commands {
391347 exclude_commands,
392348 lockdir,
393349 load,
394- csv,
395350 cluster,
396351 }
397352 }
398353 "sysinfo" => {
399- let mut json = false ;
400- let mut oldjson = false ;
401- let mut csv = false ;
402354 let mut cluster = None ;
403355 let mut topo_svg_cmd = None ;
404356 let mut topo_text_cmd = None ;
405357 while next < args. len ( ) {
406358 let arg = args[ next] . as_ref ( ) ;
407359 next += 1 ;
408360 if let Some ( new_next) = bool_arg ( arg, & args, next, "--json" ) {
409- ( next, json) = ( new_next, true ) ;
410- } else if let Some ( new_next) = bool_arg ( arg, & args, next, "--oldfmt" ) {
411- ( next, oldjson) = ( new_next, true ) ;
412- } else if let Some ( new_next) = bool_arg ( arg, & args, next, "--csv" ) {
413- ( next, csv) = ( new_next, true ) ;
361+ next = new_next;
414362 } else if let Some ( ( new_next, value) ) =
415363 string_arg ( arg, & args, next, "--cluster" )
416364 {
@@ -427,17 +375,7 @@ fn command_line() -> Commands {
427375 usage ( true ) ;
428376 }
429377 }
430- if ( json || oldjson) && csv {
431- eprintln ! ( "--csv is incompatible with --json and --oldfmt" ) ;
432- std:: process:: exit ( USAGE_ERROR ) ;
433- }
434- if json && oldjson {
435- eprintln ! ( "--json and --oldfmt are incompatible" ) ;
436- std:: process:: exit ( USAGE_ERROR ) ;
437- }
438378 Commands :: Sysinfo {
439- csv,
440- oldjson,
441379 cluster,
442380 topo_svg_cmd,
443381 topo_text_cmd,
@@ -446,8 +384,6 @@ fn command_line() -> Commands {
446384 "slurm" => {
447385 let mut window = None ;
448386 let mut span = None ;
449- let mut json = false ;
450- let mut csv = false ;
451387 let mut deluge = false ;
452388 let mut batch_size = None ;
453389 let mut cluster = None ;
@@ -461,11 +397,7 @@ fn command_line() -> Commands {
461397 } else if let Some ( ( new_next, value) ) = string_arg ( arg, & args, next, "--span" ) {
462398 ( next, span) = ( new_next, Some ( value) ) ;
463399 } else if let Some ( new_next) = bool_arg ( arg, & args, next, "--json" ) {
464- ( next, json) = ( new_next, true ) ;
465- } else if let Some ( new_next) = bool_arg ( arg, & args, next, "--oldfmt" ) {
466- ( next, csv) = ( new_next, true ) ;
467- } else if let Some ( new_next) = bool_arg ( arg, & args, next, "--csv" ) {
468- ( next, csv) = ( new_next, true ) ;
400+ next = new_next;
469401 } else if let Some ( new_next) = bool_arg ( arg, & args, next, "--deluge" ) {
470402 ( next, deluge) = ( new_next, true ) ;
471403 } else if let Some ( ( new_next, value) ) =
@@ -483,14 +415,9 @@ fn command_line() -> Commands {
483415 if window. is_some ( ) && span. is_some ( ) {
484416 usage ( true ) ;
485417 }
486- if json && csv {
487- eprintln ! ( "--csv and --json are incompatible" ) ;
488- std:: process:: exit ( USAGE_ERROR ) ;
489- }
490418 Commands :: Slurmjobs {
491419 window,
492420 span,
493- csv,
494421 cluster,
495422 deluge,
496423 batch_size,
@@ -504,9 +431,6 @@ fn command_line() -> Commands {
504431 if let Some ( new_next) = bool_arg ( arg, & args, next, "--json" ) {
505432 // Ignore, there is only one format
506433 next = new_next;
507- } else if let Some ( new_next) = bool_arg ( arg, & args, next, "--oldfmt" ) {
508- // Ignore, there is only one format
509- next = new_next;
510434 } else if let Some ( ( new_next, value) ) =
511435 string_arg ( arg, & args, next, "--cluster" )
512436 {
@@ -623,18 +547,10 @@ Options for `ps`:
623547 exists on startup [default: none]
624548 --load
625549 Print per-cpu and per-gpu load data
626- --csv
627- Format output as old CSV, not JSON
628- --oldfmt
629- Synonym for --csv
630550 --cluster name
631551 Optional cluster name with which to tag output
632552
633553Options for `sysinfo`:
634- --csv
635- Format output as CSV, not JSON
636- --oldfmt
637- Format output as the old JSON, not the new JSON
638554 --cluster name
639555 Optional cluster name with which to tag output
640556 --topo-svg-cmd
@@ -655,10 +571,6 @@ Options for `slurm`:
655571 Include PENDING and RUNNING jobs in the output, not just completed jobs.
656572 --batch-size
657573 Split into multiple JSON messages after this many job records.
658- --csv
659- Format output as CSV, not new JSON
660- --oldfmt
661- Synonym for --csv
662574 --cluster name
663575 Optional cluster name with which to tag output
664576
0 commit comments