module Magellan::Cli::Script

Constants

SETTINGS

Public Class Methods

cli(args, options = {}) click to toggle source
# File lib/magellan/cli/script.rb, line 19
def cli(args, options = {})
  args = Shellwords.split(args) if args.is_a?(String)
  args << "-V" if ARGV.include?("-V")
  $PROGRAM_NAME, backup = program_name, $PROGRAM_NAME
  self.io.puts "#{prompt}#{$PROGRAM_NAME} #{args.join(' ')}"
  begin
    Magellan::Cli::Command.start(args) do |e|
      exit(1) unless e.message =~ options[:allow]
    end
  ensure
    $PROGRAM_NAME = backup
  end
end

Private Instance Methods

cli(args, options = {}) click to toggle source
# File lib/magellan/cli/script.rb, line 19
def cli(args, options = {})
  args = Shellwords.split(args) if args.is_a?(String)
  args << "-V" if ARGV.include?("-V")
  $PROGRAM_NAME, backup = program_name, $PROGRAM_NAME
  self.io.puts "#{prompt}#{$PROGRAM_NAME} #{args.join(' ')}"
  begin
    Magellan::Cli::Command.start(args) do |e|
      exit(1) unless e.message =~ options[:allow]
    end
  ensure
    $PROGRAM_NAME = backup
  end
end