-
-
Save leejarvis/b2b2a462130fc021e6a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OPTIONS_WITH_ARGUMENTS = 'bcDeFiLlmOopRSw' | |
trash = [] | |
args = ARGV.dup | |
args.each_with_index do |arg, index| | |
next if trash.include? index | |
if arg[0, 1] == '-' && OPTIONS_WITH_ARGUMENTS.include?(arg[1, 1]) | |
trash << index | |
trash << index + 1 | |
end | |
end | |
items = args.reject.with_index { |_, i| trash.include? i } | |
p items |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment