Method: CLAide::ARGV#shift_argument

Defined in:
lib/claide/argv.rb

#shift_argumentString

Note:

This will remove the argument from the remaining parameters.

Returns The first argument in the remaining parameters.

Examples:


argv = CLAide::ARGV.new(['tea', 'white'])
argv.shift_argument # => 'tea'
argv.arguments      # => ['white']

Returns:

  • (String)

    The first argument in the remaining parameters.



130
131
132
133
134
135
136
# File 'lib/claide/argv.rb', line 130

def shift_argument
  if index = @entries.find_index { |type, _| type == :arg }
    entry = @entries[index]
    @entries.delete_at(index)
    entry.last
  end
end