Module: GitFit::RemoteHelpers
- Included in:
- RemoteConfigCLI, RemoteSecretCLI
- Defined in:
- lib/git_fit/cli/remote_cli.rb
Instance Method Summary collapse
Instance Method Details
#detect_repo(url = nil) ⇒ Object
6 7 8 9 |
# File 'lib/git_fit/cli/remote_cli.rb', line 6 def detect_repo(url = nil) url ||= `git remote get-url origin`.chomp url.sub(%r{.*github\.com[:/]}, "").sub(/\.git$/, "") end |
#gh(*args) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/git_fit/cli/remote_cli.rb', line 11 def gh(*args) repo = [:repo] || detect_repo out, err, st = Open3.capture3("gh", *args.map(&:to_s), "-R", repo) raise "gh: #{err.strip}" unless st.success? out end |