File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,16 @@ struct Args {
4949pub fn run ( argv : & [ & str ] ) -> CliResult < ( ) > {
5050 let args: Args = util:: get_args ( USAGE , argv) ?;
5151
52- if args. arg_input . to_lowercase ( ) . ends_with ( ".sz" ) {
53- return fail_incorrectusage_clierror ! ( "Cannot index a snappy file." ) ;
52+ // can only index CSV, TSV, or TAB files
53+ let exts = [ "csv" , "tsv" , "tab" , "ssv" ] ;
54+ let input_path = Path :: new ( & args. arg_input ) ;
55+ let ext = input_path
56+ . extension ( )
57+ . and_then ( std:: ffi:: os_str:: OsStr :: to_str)
58+ . map ( str:: to_ascii_lowercase) ;
59+
60+ if ext. as_deref ( ) . is_none_or ( |e| !exts. contains ( & e) ) {
61+ return fail_incorrectusage_clierror ! ( "Can only index CSV, TSV/TAB or SSV files." ) ;
5462 }
5563
5664 let pidx = match args. flag_output {
You can’t perform that action at this time.
0 commit comments