def scoped_args!(has_args, pos = 0)
      to_delete = []

      each_with_index do |arg, i|
        next if i < pos
        break if arg.start_with?('-') || !has_args.send(:more_args?)

        to_delete << i
        has_args.send(:<<, arg)
      end

      to_delete.reverse.each { |i| delete_at i }
    end
def scoped_args!(has_args, pos = 0)
      to_delete = []

      each_with_index do |arg, i|
        next if i < pos
        break if arg.start_with?('-') || !has_args.send(:more_args?)

        to_delete << i
        has_args.send(:<<, arg)
      end

      to_delete.reverse.each { |i| delete_at i }
    end
Gets all arguments passed to a specific scope, i.e. a command or an
 option.

 All arguments in the scope will be removed from the array.

 @param [HasArguments] has_args
 @param [Fixnum] pos The position of the first argument that should be
        checked. All arguments ahead of that position will be skipped.