Class: Worktree::CLI

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

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/worktree/cli.rb', line 8

def self.exit_on_failure?
  true
end

Instance Method Details

#check_staleObject



51
52
53
# File 'lib/worktree/cli.rb', line 51

def check_stale
  Worktree::Command::CheckStale.new(project_dir: options[:project_dir]).do!
end

#cherry_pick(commit) ⇒ Object



66
67
68
69
70
71
72
# File 'lib/worktree/cli.rb', line 66

def cherry_pick(commit)
  Worktree::Command::CherryPick.new(commit,
                                    to: options[:to],
                                    project_dir: options[:project_dir],
                                    clone_db: options[:clone_db],
                                    launcher_vars: options[:launcher_vars]).do!
end

#configureObject



75
76
77
# File 'lib/worktree/cli.rb', line 75

def configure
  Worktree::Command::Configure.new.do!
end

#init(uri) ⇒ Object



83
84
85
86
87
88
# File 'lib/worktree/cli.rb', line 83

def init(uri)
  Worktree::Command::Init.new(uri,
                              path: options[:path],
                              name: options[:name],
                              remote: options[:remote]).do!
end

#new(branch) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/worktree/cli.rb', line 18

def new(branch)
  Worktree::Command::Add.new(branch,
                             from: options[:from],
                             project_dir: options[:project_dir],
                             clone_db: options[:clone_db],
                             fetch_remote: options[:fetch_remote],
                             launcher_vars: options[:launcher_vars]).do!
end

#open(branch) ⇒ Object



30
31
32
33
34
# File 'lib/worktree/cli.rb', line 30

def open(branch)
  Worktree::Command::Open.new(branch,
                              project_dir: options[:project_dir],
                              launcher_vars: options[:launcher_vars]).do!
end

#remove(branch) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/worktree/cli.rb', line 41

def remove(branch)
  Worktree::Command::Remove.new(branch,
                                project_dir: options[:project_dir],
                                drop_db: options[:drop_db],
                                drop_remote_branch: options[:drop_remote_branch],
                                check_merged: options[:check_merged]).do!
end

#remove_staleObject



57
58
59
# File 'lib/worktree/cli.rb', line 57

def remove_stale
  Worktree::Command::RemoveStale.new(project_dir: options[:project_dir]).do!
end