Sha256: 9e79ce8f84f70b51f2be8827ac43e3dfe4830d0f28e6218da71e9284d7a95bc4

Contents?: true

Size: 802 Bytes

Versions: 7

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

module Baz
  class CLI < Dry::CLI::Command
    desc "Baz command line interface"
    argument :mandatory_arg, required: true, aliases: %w[m], desc: "Mandatory argument"
    argument :optional_arg, aliases: %w[o],
                            desc: "Optional argument (has to have default value in call method)"
    option :option_one, aliases: %w[1], desc: "Option one"
    option :boolean_option, aliases: %w[b], desc: "Option boolean", type: :boolean
    option :option_with_default, aliases: %w[d], desc: "Option default", default: "test"

    def call(mandatory_arg:, optional_arg: "optional_arg", **options)
      puts "mandatory_arg: #{mandatory_arg}. " \
             "optional_arg: #{optional_arg}. " \
             "Options: #{options.inspect}"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rfix-3.0.1 vendor/dry-cli/spec/support/fixtures/baz_command.rb
rfix-3.0.0 vendor/dry-cli/spec/support/fixtures/baz_command.rb
rfix-2.0.4 vendor/dry-cli/spec/support/fixtures/baz_command.rb
rfix-2.0.3 vendor/dry-cli/spec/support/fixtures/baz_command.rb
rfix-2.0.2 vendor/dry-cli/spec/support/fixtures/baz_command.rb
rfix-2.0.1 vendor/dry-cli/spec/support/fixtures/baz_command.rb
rfix-2.0.0 vendor/dry-cli/spec/support/fixtures/baz_command.rb