# 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