Sha256: 7ea2131d946c88c37c42a3e7ce80def11d4a70e822d73cbab6e58c359acbb3a2

Contents?: true

Size: 747 Bytes

Versions: 2

Compression:

Stored size: 747 Bytes

Contents

require "optimist"

module Mobilis
  class CommandLine
    def self.parse_args(args)
      options = {}
      Optimist.options(args) do
        banner "multi-project codebase generation toolkit"
        stop_on ["load", "build", "help"]
      end
      if args == []
        options[:subcommand] = :interactive
        return options
      end
      options[:subcommand] = args.shift.to_sym
      case options[:subcommand]
      when :load
        options[:filename] = args.shift
      when :build
        options[:filename] = args.shift
      when :help
        puts "I think we'd all like a little help."
      else
        Optimist::die "unknown subcommand #{cmd.inspect}"
      end
      options
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mobilis-0.0.5 lib/mobilis/command_line.rb
mobilis-0.0.4 lib/mobilis/command_line.rb