cleanup command line processing of primary command
This commit is contained in:
parent
9c3957d582
commit
341979d937
@ -39,12 +39,8 @@ module Compass
|
|||||||
protected
|
protected
|
||||||
|
|
||||||
def perform!
|
def perform!
|
||||||
if options[:version]
|
if options[:command]
|
||||||
do_command(:print_version)
|
do_command(options[:command])
|
||||||
elsif options[:update]
|
|
||||||
do_command(:update_project)
|
|
||||||
elsif options[:project_name]
|
|
||||||
do_command(:create_project)
|
|
||||||
else
|
else
|
||||||
puts self.opts
|
puts self.opts
|
||||||
end
|
end
|
||||||
@ -56,6 +52,7 @@ module Compass
|
|||||||
if ARGV.size > 0
|
if ARGV.size > 0
|
||||||
self.options[:project_name] = ARGV.shift
|
self.options[:project_name] = ARGV.shift
|
||||||
end
|
end
|
||||||
|
self.options[:command] ||= self.options[:project_name] ? :create_project : :update_project
|
||||||
self.options[:environment] ||= :production
|
self.options[:environment] ||= :production
|
||||||
self.options[:framework] ||= :compass
|
self.options[:framework] ||= :compass
|
||||||
end
|
end
|
||||||
@ -73,18 +70,14 @@ Description:
|
|||||||
Options:
|
Options:
|
||||||
END
|
END
|
||||||
opts.on('-u', '--update', :NONE, 'Update the current project') do
|
opts.on('-u', '--update', :NONE, 'Update the current project') do
|
||||||
self.options[:update] = true
|
self.options[:command] = :update_project
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-f FRAMEWORK', '--framework FRAMEWORK', [:compass, :blueprint], 'Set up a new project using the selected framework. Legal values: compass (default), blueprint') do |framework|
|
opts.on('-f FRAMEWORK', '--framework FRAMEWORK', [:compass, :blueprint], 'Set up a new project using the selected framework. Legal values: compass (default), blueprint') do |framework|
|
||||||
self.options[:framework] = framework
|
self.options[:framework] = framework
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('--force', :NONE, 'Force. Allows some commands to succeed when they would otherwise fail.') do
|
opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment: development, production (default)') do |env|
|
||||||
self.options[:force] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment (development, production)') do |env|
|
|
||||||
self.options[:environment] = env
|
self.options[:environment] = env
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -104,13 +97,17 @@ END
|
|||||||
self.options[:trace] = true
|
self.options[:trace] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
opts.on('--force', :NONE, 'Force. Allows some commands to succeed when they would otherwise fail.') do
|
||||||
|
self.options[:force] = true
|
||||||
|
end
|
||||||
|
|
||||||
opts.on_tail("-?", "-h", "--help", "Show this message") do
|
opts.on_tail("-?", "-h", "--help", "Show this message") do
|
||||||
puts opts
|
puts opts
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on_tail("-v", "--version", "Print version") do
|
opts.on_tail("-v", "--version", "Print version") do
|
||||||
self.options[:version] = true
|
self.options[:command] = :print_version
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user