Class: MGit::Add

Inherits:
BaseCommand show all
Defined in:
lib/m-git/command/add.rb

Overview

follow git add eg: mgit add .

Constant Summary

Constants inherited from BaseCommand

BaseCommand::HIGH_PRIORITY_OPT_LIST, BaseCommand::SELECTABLE_OPT_LIST

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseCommand

#all_repos, cmd, #exec_light_repos, #generate_config_repo, inherited, #initialize, #locked_repos, #run

Constructor Details

This class inherits a constructor from MGit::BaseCommand

Class Method Details

.descriptionObject



29
30
31
# File 'lib/m-git/command/add.rb', line 29

def self.description
  "将文件改动加入暂存区。"
end

.usageObject



35
36
37
# File 'lib/m-git/command/add.rb', line 35

def self.usage
  "mgit add [<git-add-option>] [(--mrepo|--el-mrepo) <repo>...] [--help]"
end

Instance Method Details

#enable_repo_selectionObject



23
24
25
# File 'lib/m-git/command/add.rb', line 23

def enable_repo_selection
  true
end

#execute(argv) ⇒ Object



13
14
15
16
17
18
# File 'lib/m-git/command/add.rb', line 13

def execute(argv)
  Workspace.check_branch_consistency
  Output.puts_start_cmd
  _, error_repos = Workspace.execute_git_cmd_with_repos(argv.cmd, argv.git_opts, all_repos)
  Output.puts_succeed_cmd(argv.absolute_cmd) if error_repos.length == 0
end