Class: MGit::BaseCommand
- Inherits:
-
Object
- Object
- MGit::BaseCommand
- Defined in:
- lib/m-git/base_command.rb
Direct Known Subclasses
Add, Branch, Checkout, Clean, Commit, Config, Delete, Fetch, Forall, Info, Init, Log, Merge, Pull, Push, Rebase, Reset, Self, Stash, Status, Sync, Tag
Constant Summary collapse
- HIGH_PRIORITY_OPT_LIST =
{ :help => '--help', :help_s => '-h', :auto_exec => '--auto-exec' }.freeze
- SELECTABLE_OPT_LIST =
注意使用时跟指令自身设置的参数对比,避免冲突
{ :mrepo => '--mrepo', :mrepo_s => '-m', :exclude_mrepo => '--el-mrepo', :exclude_mrepo_s => '-e', :include_lock => '--include-lock', :include_lock_s => '-i', :continue => '--continue', :abort => '--abort', }.freeze
Class Method Summary collapse
-
.cmd ⇒ Object
当前命令行的命令比如checkout / status /..
- .inherited(sub_klass) ⇒ Object
Instance Method Summary collapse
-
#all_repos(except_config: false) ⇒ Object
————— Workspace Bridge.
- #exec_light_repos ⇒ Object
- #generate_config_repo ⇒ Object
-
#initialize(argv) ⇒ BaseCommand
constructor
初始化.
- #locked_repos ⇒ Object
-
#run ⇒ Object
— 禁止覆写 — 执行主方法.
Constructor Details
#initialize(argv) ⇒ BaseCommand
初始化
45 46 47 48 49 50 51 |
# File 'lib/m-git/base_command.rb', line 45 def initialize(argv) # 指令解析 setup_argv(argv) process_highest_priority_option(argv) validate(argv) @argv = argv end |
Class Method Details
.cmd ⇒ Object
当前命令行的命令比如checkout / status /..
14 15 16 |
# File 'lib/m-git/base_command.rb', line 14 def self.cmd name.split('::').last.downcase end |
.inherited(sub_klass) ⇒ Object
9 10 11 |
# File 'lib/m-git/base_command.rb', line 9 def self.inherited(sub_klass) CommandManager.register_command(sub_klass.cmd, sub_klass) end |
Instance Method Details
#all_repos(except_config: false) ⇒ Object
Workspace Bridge
67 68 69 |
# File 'lib/m-git/base_command.rb', line 67 def all_repos(except_config:false) Workspace.all_repos(except_config: except_config) end |
#exec_light_repos ⇒ Object
75 76 77 |
# File 'lib/m-git/base_command.rb', line 75 def exec_light_repos Workspace.exec_light_repos end |
#generate_config_repo ⇒ Object
79 80 81 |
# File 'lib/m-git/base_command.rb', line 79 def generate_config_repo Workspace.generate_config_repo end |
#locked_repos ⇒ Object
71 72 73 |
# File 'lib/m-git/base_command.rb', line 71 def locked_repos Workspace.locked_repos end |
#run ⇒ Object
— 禁止覆写 — 执行主方法
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/m-git/base_command.rb', line 55 def run begin __config_repo_filter pre_exec execute(@argv) post_exec rescue SystemExit, Interrupt did_interrupt end end |