Top Level Namespace

Defined Under Namespace

Modules: Fig

Instance Method Summary collapse

Instance Method Details

#cmd_args(command, args) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/fig/lock/cli.rb', line 5

def cmd_args(command, args)
  if args.empty?
    {}
  elsif args.size == 1
    {file: args[0]}
  else
    fail "Usage: fig-lock #{command} <file>"
  end
end

#execute(&block) ⇒ Object

Execute a block.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fig/lock/cli.rb', line 16

def execute(&block)
  run do |opts, args|
    begin
      yield(opts, args)
    rescue StandardError => bang
      if ENV['DEBUG']
        Fig::Lock::Log.log.fatal bang
      else
        Fig::Lock::Log.log.fatal bang.message
      end
    end
  end
end