-a
This commit is contained in:
parent
246800ddb1
commit
cb68ba2b41
1 changed files with 9 additions and 20 deletions
27
ls.rb
27
ls.rb
|
@ -1,25 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'optparse'
|
||||
|
||||
def options
|
||||
secret_files = {}
|
||||
opt = OptionParser.new
|
||||
opt.on('-a') { |v| params[:a] = v }
|
||||
opt.on('-r') { |v| params[:r] = v }
|
||||
secret_files[:dir] = opt.parse!(ARGV)[0]
|
||||
secret_files
|
||||
end
|
||||
|
||||
SELECTED = options
|
||||
|
||||
def get_files(option_a: false)
|
||||
if option_a
|
||||
Dir.glob('*', File::FNM_DOTMATCH, base: SELECTED[:dir])
|
||||
else
|
||||
Dir.glob('*', base: SELECTED[:dir])
|
||||
end
|
||||
end
|
||||
opt = OptionParser.new
|
||||
params = {}
|
||||
opt.on('-a') { |x| params[:a] = x }
|
||||
opt.parse(ARGV)
|
||||
|
||||
COLUMNS = 3
|
||||
|
||||
|
@ -31,7 +16,11 @@ def run
|
|||
end
|
||||
|
||||
def list_filenames
|
||||
if ARGV[0]
|
||||
Dir.glob('*', File::FNM_DOTMATCH)
|
||||
else
|
||||
Dir.glob('*')
|
||||
end
|
||||
end
|
||||
|
||||
def slice_filenames(listed_filenames)
|
||||
|
|
Loading…
Reference in a new issue