colorls/exe/colorls
t-mangoe 64b1891c2c Set exit status code when specified path doesn't exist
Similar to GNU ls, status code `2` is reported if an argument given on the
command line does not exist.

Close #397
2020-10-07 09:58:01 +02:00

26 lines
471 B
Ruby
Executable file

#!/usr/bin/env ruby
# frozen_string_literal: true
# workaround https://github.com/rubygems/rubygems/issues/3087
# rubocop:disable Style/GlobalVars
$loading = true
class Dir
@@old_pwd = singleton_method(:pwd) # rubocop:disable Style/ClassVars
def self.pwd
@@old_pwd.call
rescue Errno::ENOENT => e
return '/' if $loading
raise e
end
end
require 'colorls'
$loading = false
# rubocop:enable Style/GlobalVars
exit ColorLS::Flags.new(*ARGV).process