Class: Worktrees::App

Inherits:
Object
  • Object
show all
Defined in:
lib/worktrees/cli.rb

Class Method Summary collapse

Class Method Details

.startObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/worktrees/cli.rb', line 17

def self.start
  begin
    # Ensure we're in a git repository
    unless Dir.exist?('.git') || system('git rev-parse --git-dir >/dev/null 2>&1')
      warn 'ERROR: Not in a git repository'
      warn 'Run this command from inside a git repository'
      exit(1)
    end

    Dry::CLI.new(CLI).call
  rescue Interrupt
    warn "\nInterrupted"
    exit(130)
  rescue StandardError => e
    warn "ERROR: #{e.message}"
    exit(1)
  end
end