Class: Worktree::CLI
- Inherits:
-
Thor
- Object
- Thor
- Worktree::CLI
- Defined in:
- lib/worktree/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #cherry_pick(commit) ⇒ Object
- #configure ⇒ Object
- #new(branch) ⇒ Object
- #open(branch) ⇒ Object
- #remove(*branches) ⇒ Object
- #remove_stale ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
8 9 10 |
# File 'lib/worktree/cli.rb', line 8 def self.exit_on_failure? true end |
Instance Method Details
#cherry_pick(commit) ⇒ Object
48 49 50 51 52 |
# File 'lib/worktree/cli.rb', line 48 def cherry_pick(commit) Worktree::Command::CherryPick.new(commit, to: [:to], project_dir: [:project_dir]).do! end |
#configure ⇒ Object
55 56 57 |
# File 'lib/worktree/cli.rb', line 55 def configure Worktree::Command::Configure.new.do! end |
#new(branch) ⇒ Object
15 16 17 18 19 |
# File 'lib/worktree/cli.rb', line 15 def new(branch) Worktree::Command::Add.new(branch, from: [:from], project_dir: [:project_dir]).do! end |
#open(branch) ⇒ Object
23 24 25 26 |
# File 'lib/worktree/cli.rb', line 23 def open(branch) Worktree::Command::Open.new(branch, project_dir: [:project_dir]).do! end |
#remove(*branches) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/worktree/cli.rb', line 30 def remove(*branches) branches.each do |b| Worktree::Command::Remove.new(b, project_dir: [:project_dir]).do! end end |
#remove_stale ⇒ Object
39 40 41 42 43 |
# File 'lib/worktree/cli.rb', line 39 def remove_stale Worktree::Command::RemoveStale.new(project_dir: [:project_dir]).do! rescue TTY::Reader::InputInterrupt Worktree.logger.info { "You've interrupted removing of stale branches!" } end |