Method: MGit::Config#execute

Defined in:
lib/m-git/command/config.rb

#execute(argv) ⇒ Object




73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/m-git/command/config.rb', line 73

def execute(argv)
  argv.enumerate_valid_opts { |opt|
    if opt.key == OPT_LIST[:update_manifest]
      update_mgit_config(opt.value)
      return
    elsif opt.key == OPT_LIST[:update_local]
      update_local_config(opt.value)
      return
    elsif opt.key == OPT_LIST[:create_local]
      dir = opt.value
      if opt.value.is_a?(TrueClass)
        Workspace.setup_config
        if Workspace.config.config_repo.nil?
          Foundation.help!("未找到配置仓库,请为参数\"--create-local\"或\"-c\"指定一个具体文件夹目录并重试!")
        else
          dir = Workspace.config.config_repo.abs_dest(Workspace.root)
        end
      end
      create_local_config(dir)
      return
    elsif opt.key == OPT_LIST[:list]
      dump_config
    elsif opt.key == OPT_LIST[:set]
      set_config(opt.value)
    end
  }
end