class Escalator::Command::Setup
Attributes
commands[R]
custom_plugins[R]
output_path[R]
set_zshcompletion[R]
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
# File lib/escalator/command/setup.rb, line 51 def initialize argv @commands = argv.arguments!.uniq @output_path = argv.option "output-path" @set_zshcompletion = argv.flag? "set-zshcompletion", false super end
options()
click to toggle source
Calls superclass method
Escalator::Command::options
# File lib/escalator/command/setup.rb, line 44 def self.options [ ["--output-path=path", "path 为参数模版导出路径"], ["--set-zshcompletion", "会忽略其他参数, 只设置 oh-my-zsh 的命令补全插件到 custom/plugins 中, zshrc 配置插件, 请自己手动更新, 默认: 否"] ].concat super end
Public Instance Methods
help!(error_message = nil)
click to toggle source
# File lib/escalator/command/setup.rb, line 79 def help!(error_message = nil) invoked_command_class.help!(error_message, Help) end
run()
click to toggle source
# File lib/escalator/command/setup.rb, line 83 def run Escalator::Setup.run self end
validate!()
click to toggle source
Calls superclass method
# File lib/escalator/command/setup.rb, line 58 def validate! super if set_zshcompletion if ENV["ZSH"].empty? help! "未检测到 oh-my-zsh, 请先进行安装" end @custom_plugins = "#{ENV["ZSH"]}/custom/plugins/" return end if commands.empty? help! "未检测到 COMMAND 参数" end cmds = (commands - (%w(confuse archive resign upload) & commands)) if !cmds.empty? help! "检测到 非法参数: #{cmds.join ", "}" end if !output_path help! "未检测到 --output-path 参数" end end