mirror of
https://github.com/athityakumar/colorls.git
synced 2024-09-19 05:31:23 +02:00
Added invalid flags' usage error message
This commit is contained in:
parent
f2d78eafe9
commit
ed3a5cfc7c
1 changed files with 8 additions and 0 deletions
|
@ -192,6 +192,14 @@ sort_dirs_first = args.include?('-sd') || args.include?('--sort-dirs')
|
||||||
show_files_only = args.include?('-f') || args.include?('--files')
|
show_files_only = args.include?('-f') || args.include?('--files')
|
||||||
show_dirs_only = args.include?('-d') || args.include?('--dirs')
|
show_dirs_only = args.include?('-d') || args.include?('--dirs')
|
||||||
|
|
||||||
|
if sort_dirs_first && sort_files_first
|
||||||
|
raise ArgumentError, 'Restrain from using -sd and -sf flags together'
|
||||||
|
end
|
||||||
|
|
||||||
|
if show_files_only && show_dirs_only
|
||||||
|
raise ArgumentError, 'Restrain from using -d and -f flags together'
|
||||||
|
end
|
||||||
|
|
||||||
sort = if sort_files_first
|
sort = if sort_files_first
|
||||||
'files'
|
'files'
|
||||||
elsif sort_dirs_first
|
elsif sort_dirs_first
|
||||||
|
|
Loading…
Reference in a new issue