mirror of
https://github.com/athityakumar/colorls.git
synced 2024-09-19 05:31:23 +02:00
64b1891c2c
Similar to GNU ls, status code `2` is reported if an argument given on the command line does not exist. Close #397
26 lines
471 B
Ruby
Executable file
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
|