Sha256: 61d1f5f4f7d491fbaaf644205e680d38623e84d96f42a8d8b0fc0bc75051f5fd

Contents?: true

Size: 793 Bytes

Versions: 117

Compression:

Stored size: 793 Bytes

Contents

module Eco
  class CLI
    class Scripting
      class Argument

        attr_reader :key

        class << self
          def is_modifier?(value)
           value&.start_with?("-")
          end
        end

        def initialize(key, with_param: false)
          @key        = key
          @with_param = !!with_param
        end

        def args_slice(*args)
          #pp "known arg '#{key}' => included? #{args.include?(key)}"
          return args unless args.include?(key)
          i = args.index(key)
          j = with_param?? i+1 : i
          args - args.slice(i..j)
        end

        def with_param!
          @with_param = true
        end

        def with_param?
          @with_param
        end
        
      end
    end
  end
end

Version data entries

117 entries across 117 versions & 1 rubygems

Version Path
eco-helpers-2.0.65 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.64 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.63 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.62 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.61 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.60 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.59 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.58 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.57 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.56 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.55 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.54 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.53 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.52 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.51 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.50 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.49 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.48 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.47 lib/eco/cli/scripting/argument.rb
eco-helpers-2.0.46 lib/eco/cli/scripting/argument.rb