Class: GitSnip::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/git_snip/cli.rb

Instance Method Summary collapse

Instance Method Details

#snipObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/git_snip/cli.rb', line 24

def snip
  if options[:dry_run]
    return dry_run
  end

  if !options[:force]
    say '-f option is needed to delete branches.', :red
    exit 64
  end

  cleaner = GitSnip::Cleaner.new(*cleaner_args)

  say 'Deleting the following branches...', :green
  say

  deleted_branches = cleaner.delete_merged_branches do |branch|
    say_branch_info(branch)
    true
  end

  if deleted_branches.empty?
    say 'No branches were deleted.', :green
  else
    say "\n\nDone.", :green
  end
end