1+ use bat:: bat_warning;
12use clap:: { crate_name, crate_version, App as ClapApp , AppSettings , Arg , ArgGroup , SubCommand } ;
23use once_cell:: sync:: Lazy ;
34use std:: env;
@@ -369,33 +370,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
369370 . help ( "Display all supported highlighting themes." )
370371 . long_help ( "Display a list of supported themes for syntax highlighting." ) ,
371372 )
372- . arg (
373- Arg :: with_name ( "header-info" )
374- . long ( "header-info" )
375- . value_name ( "components" )
376- . use_delimiter ( true )
377- . takes_value ( true )
378- . possible_values ( & [ "full" , "auto" , "filename" , "size" , "last-modified" , "permissions" ] )
379- . help (
380- "Comma-separated list of header information elements to display \
381- (full, filename, size, last-modified, permissions).",
382- )
383- . long_help (
384- "Configure what information (filename, file size, last modification date, \
385- permissions, ..) to display in the header.\
386- The argument is a comma-separated list of \
387- components to display (e.g. 'filename,size,last-modified') or all of them ('full'). \
388- To set a default set of header information, add the \
389- '--header-info=\" ..\" ' option to the configuration file or export the \
390- BAT_HEADER_INFO environment variable (e.g.: export BAT_HEADER_INFO=\" ..\" ).\n \n \
391- Possible values:\n \n \
392- * full: enables all available components (default).\n \
393- * filename: displays the file name.\n \
394- * size: displays the size of the file in human-readable format.\n \
395- * last-modified: displays the last modification timestamp of the file.\n \
396- * permissions: displays the file owner, group and mode.",
397- ) ,
398- )
399373 . arg (
400374 Arg :: with_name ( "style" )
401375 . long ( "style" )
@@ -411,13 +385,17 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
411385 . validator ( |val| {
412386 let mut invalid_vals = val. split ( ',' ) . filter ( |style| {
413387 !& [
414- "auto" , "full" , "plain" , "header" , "grid" , "rule" , "numbers" , "snip" ,
388+ "auto" , "full" , "plain" , "header" , "filename" , "filesize" , "permissions" , "lastmodified" , " grid", "rule" , "numbers" , "snip" ,
415389 #[ cfg( feature = "git" ) ]
416390 "changes" ,
417391 ]
418392 . contains ( style)
419393 } ) ;
420394
395+ if val. contains ( "header" ) {
396+ bat_warning ! ( "Style 'header' is deprecated, use 'filename' instead." ) ;
397+ }
398+
421399 if let Some ( invalid) = invalid_vals. next ( ) {
422400 Err ( format ! ( "Unknown style, '{}'" , invalid) )
423401 } else {
@@ -441,7 +419,10 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
441419 * auto: same as 'full', unless the output is piped.\n \
442420 * plain: disables all available components.\n \
443421 * changes: show Git modification markers.\n \
444- * header: show filenames before the content.\n \
422+ * filename: displays the file name.\n \
423+ * size: displays the size of the file in human-readable format.\n \
424+ * last-modified: displays the last modification timestamp of the file.\n \
425+ * permissions: displays the file owner, group and mode.\n \
445426 * grid: vertical/horizontal lines to separate side bar\n \
446427 and the header from the content.\n \
447428 * rule: horizontal lines to delimit files.\n \
0 commit comments