lib/mobilis/command_line.rb in mobilis-0.0.3 vs lib/mobilis/command_line.rb in mobilis-0.0.4
- old
+ new
@@ -3,40 +3,26 @@
module Mobilis
class CommandLine
def self.parse_args(args)
options = {}
Optimist.options(args) do
- banner "checklist code janitor"
- stop_on ["new", "check", "add"]
+ banner "multi-project codebase generation toolkit"
+ stop_on ["load", "build", "help"]
end
- if args.length == 0
- options[:subcommand] = :help
+ if args == []
+ options[:subcommand] = :interactive
return options
end
options[:subcommand] = args.shift.to_sym
case options[:subcommand]
- when :new
- Optimist.options(args) do
- stop_on ["gem", "railsapp", "railsapi"]
- end
- options[:new_type] = args.shift.to_sym
- options[:name] = case options[:new_type]
- when :gem
- args.shift
- when :railsapp
- args.shift
- when :railsapi
- args.shift
- end
- when :add
- Optimist.options(args) do
- stop_on ["gem", "docker"]
- end
- options[:add_type] = args.shift.to_sym
- case options[:add_type]
- when :gem
- options[:name] = args.shift
- end
+ 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