lib/magellan/cli/command.rb in magellan-cli-0.3.2 vs lib/magellan/cli/command.rb in magellan-cli-0.3.3
- old
+ new
@@ -35,28 +35,28 @@
super(shell, subcommand)
shell.say
shell.say "RESOURCES:"
shell.say " " << Resources::MAPPING.keys.join(", ")
- shell.say " type `#{File.basename($0)} help RESOURCE` for more detail"
+ shell.say " " << I18n.t(:for_more_detail, scope: [:command, :cmd_help], command: File.basename($0))
shell.say
end
end
Resources::MAPPING.each do |classname, name|
- desc "#{name} SUBCOMMAND ...ARGS", "Manage #{name.pluralize}"
+ desc "#{name} SUBCOMMAND ...ARGS", I18n.t(:manage_resource, scope: [:command, :cmd], resource: name.pluralize)
subcommand name, ::Magellan::Cli::Resources.const_get(classname)
end
COMMAND_ORDER = %w[login] + Resources::MAPPING.values
#desc "direct SUBCOMMAND ...ARGS", "Send request directly"
#subcommand "direct", ::Magellan::Cli::Direct
- desc "login", "Login to the Magellan server"
- method_option :email, aliases: "-e", desc: "email address for login"
- method_option :password, aliases: "-p", desc: "password for login"
+ desc "login", I18n.t(:login, scope: [:command, :cmd])
+ method_option :email, aliases: "-e", desc: I18n.t(:email, scope: [:command, :cmd_login])
+ method_option :password, aliases: "-p", desc: I18n.t(:password, scope: [:command, :cmd_login])
def login
unless email = options[:email]
print "email: "
email = STDIN.gets.strip
end
@@ -68,10 +68,10 @@
end
Magellan::Cli::Http.new.login!(email, password)
end
- desc "info", "Show login user and selected resources"
+ desc "info", I18n.t(:info, scope: [:command, :cmd])
def info
cli = Magellan::Cli::Login.new
cli.check_login_auth!
selections = load_selections || {}
d = {"user" => cli.login_auth["email"] }