-a
This commit is contained in:
parent
cb68ba2b41
commit
c7f6fa3bc1
1 changed files with 3 additions and 9 deletions
12
ls.rb
12
ls.rb
|
@ -1,10 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
opt = OptionParser.new
|
|
||||||
params = {}
|
|
||||||
opt.on('-a') { |x| params[:a] = x }
|
|
||||||
opt.parse(ARGV)
|
|
||||||
|
|
||||||
COLUMNS = 3
|
COLUMNS = 3
|
||||||
|
|
||||||
|
@ -16,11 +12,9 @@ def run
|
||||||
end
|
end
|
||||||
|
|
||||||
def list_filenames
|
def list_filenames
|
||||||
if ARGV[0]
|
params = ARGV.getopts('a')
|
||||||
Dir.glob('*', File::FNM_DOTMATCH)
|
flags = params['a'] ? File::FNM_DOTMATCH : 0
|
||||||
else
|
Dir.glob('*', flags)
|
||||||
Dir.glob('*')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def slice_filenames(listed_filenames)
|
def slice_filenames(listed_filenames)
|
||||||
|
|
Loading…
Reference in a new issue