This commit is contained in:
Rikuoh Tsujitani 2024-04-26 08:55:27 +09:00
parent a6fb0f99ba
commit 04618d986f

21
ls.rb
View file

@ -1,5 +1,26 @@
# 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_OPTION[:dir])
else
Dir.glob('*', base: SELECTED[:dir])
end
end
COLUMNS = 3
def run