Sha256: e84209adddfb9f90e188ade53c2e8703de84d1871dd8fdf196e54d5fa978b332

Contents?: true

Size: 693 Bytes

Versions: 1

Compression:

Stored size: 693 Bytes

Contents

# frozen_string_literal: true

require 'thor'
require 'gitlab'
require 'tty-spinner'
require 'tty-progressbar'
require 'tty-table'
require 'tty-prompt'

require 'gl/cli'

module Gl
  class Error < StandardError; end
  def self.current_project(project = nil)
    prompt = TTY::Prompt.new
    current_remote = project || `git config --get remote.origin.url`.chomp

    if current_remote.empty?
      current_remote = prompt.ask('No remote found, please enter a project (like `group/project`)')
    end

    current_remote.gsub(%r{ssh://.*:222/(.*).git}, '\1')
  end

  def self.open_in_browser(url)
    url = "#{Gitlab.endpoint.gsub('api/v4', '')}#{url}"
    `sensible-browser #{url}`
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gl-0.1.0 lib/gl.rb