lib/meroku/options.rb in meroku-2.0.24 vs lib/meroku/options.rb in meroku-2.0.25
- old
+ new
@@ -15,23 +15,46 @@
private
def define_options(_args)
OptionParser.new do |opts|
opts.banner = 'Usage: meroku [options]'
+ opts.on('--help', 'Prints this help') { puts opts }
+ add_user_options(opts)
+ add_key_options(opts)
+ add_app_options(opts)
+ opts.separator ''
+ add_maintainer_options(opts)
+ end
+ end
- opts.on('--help', 'Prints this help') do
- puts opts
- end
+ def add_key_options(opts)
+ option(opts, '--keys-add') { @options[:keys_add] = true }
+ option(opts, '--keys') { @options[:keys] = true }
+ option(opts, '--keys-remove ID') do |key_id|
+ @options[:keys_remove] = true
+ @options[:key_id] = key_id
+ end
+ end
- add_users_registration_options(opts)
- add_users_login_options(opts)
- opts.separator ''
- add_maintainers_options(opts)
+ def add_app_options(opts)
+ option(opts, '--create NAME') do |name|
+ @options[:create] = true
+ @options[:name] = name
end
+ option(opts, '--list-apps') { @options[:list_apps] = true }
+ option(opts, '--delete-app NAME') do |name|
+ @options[:delete_app] = true
+ @options[:name] = name
+ end
end
- def add_users_registration_options(opts)
+ def add_user_options(opts)
+ add_user_registration_options(opts)
+ add_user_login_options(opts)
+ end
+
+ def add_user_registration_options(opts)
option(opts, '--signup EMAIL,PASSWORD', Array) do |list|
@options[:signup] = true
@options[:email] = list[0]
@options[:password] = list[1]
end
@@ -40,22 +63,22 @@
@options[:email] = list[0]
@options[:password] = list[1]
end
end
- def add_users_login_options(opts)
+ def add_user_login_options(opts)
option(opts, '--login EMAIL,PASSWORD', Array) do |list|
@options[:login] = true
@options[:email] = list[0]
@options[:password] = list[1]
end
option(opts, '--logout') do
@options[:logout] = true
end
end
- def add_maintainers_options(opts)
+ def add_maintainer_options(opts)
option(opts, '--spawn MEROKU_SECRET') do |meroku_secret|
@options[:spawn] = true
@options[:meroku_secret] = meroku_secret
end
option(opts, '--despawn MEROKU_SECRET') do |meroku_secret|
@@ -85,9 +108,11 @@
# This module contains help texts for command line options.
module OptionsHelp
TEXT = {
version: 'Display version.',
- spawn: 'Spawn infrastructure'
+ spawn: 'Spawn infrastructure',
+ keys: 'List already uploaded keys',
+ create: 'Create an app'
}.freeze
end
end