Sha256: e68376ec3999a8564bbf123e227f05f6f6519047059de20ca812f1de32b4bd2e

Contents?: true

Size: 719 Bytes

Versions: 2

Compression:

Stored size: 719 Bytes

Contents

class Commander::Command
  def action(*args, &block)
    Brief.default_cli_options(self)

    when_called do |args, options|
      options.default(root: Brief.pwd)
      Brief.case = Brief::Briefcase.new(root: Pathname(options.root))

      block.call(args, options)
    end
  end
end

module Brief
  def self.cli_action(c, &block)
    c.action do |args, options|
      options.default(root: Brief.pwd)

      Brief.case = Brief::Briefcase.new(root: Pathname(options.root))

      block.call(args, options)
    end
  end

  def self.default_cli_options(c)
    c.option '--root DIRECTORY', String, 'The root for the briefcase'
    c.option '--config FILE', String, 'Path to the config file for this briefcase'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brief-1.9.0 lib/brief/cli/01_extensions.rb
brief-1.8.12 lib/brief/cli/01_extensions.rb