diff --git a/ls.rb b/ls.rb index e6c1006..d471a64 100644 --- a/ls.rb +++ b/ls.rb @@ -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