Sha256: d5690cfdc0de1ebca13baed7c77cc27669b88a0d9d7bb21e047f2143e8c5a3aa

Contents?: true

Size: 836 Bytes

Versions: 1

Compression:

Stored size: 836 Bytes

Contents

command "run command" do |c|
  c.syntax = 'brief run FILE'
  c.description = 'run a script in the context of the briefcase'

  c.option '--root PATH', String, 'The briefcase root'

  c.action do |args, options|
    options.default(root: Pathname(args.first || Brief.pwd))

    command = args.first.to_s.to_sym

    bc = Brief.case = Brief::Briefcase.new(root: Pathname(args.first || options.root))
    bc = bc.call if bc.respond_to?(:call)

    if !Brief.commands[command.to_sym]
      puts "Invalid command. #{ Brief.commands.keys }"
    else
      bc.run_command(command.to_sym, *args)
    end
  end
end

command "run" do |c|
  c.syntax = 'brief run FILE'
  c.description = 'run a script in the context of the briefcase'

  c.action do |args, options|
    code = Pathname(args.first).read
    Brief.case.instance_eval(code)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brief-1.15.3 lib/brief/cli/run.rb