Method: GitCli::Repos#add_remote

Defined in:
lib/git_cli/repos.rb

#add_remote(name, url) ⇒ Object

remote_config



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/git_cli/repos.rb', line 55

def add_remote(name, url)

  raise_if_empty(name, "Remote name cannot be empty to add", GitCliException)
  raise_if_empty(url, "Remote URL cannot be empty to add", GitCliException)

  check_vcs

  cmd = []
  cmd << "cd"
  cmd << @wsPath
  cmd << "&&"
  cmd << @vcs.exe_path
  cmd << "remote"
  cmd << "add"
  cmd << name
  cmd << url

  cmdln = cmd.join(" ")
  log_debug "Add remote config : #{cmdln}"
  res = os_exec(cmdln) do |st, res|
    
    if st.success?
      [true, res.strip]
    else
      [false, res.strip]
    end
  end


end