Class: GitSnip::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.help(shell, subcommand = 'snip') ⇒ Object



15
16
17
# File 'lib/git_snip/cli.rb', line 15

def help(shell, subcommand = 'snip')
  command_help(shell, subcommand)
end

Instance Method Details

#snipObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/git_snip/cli.rb', line 39

def snip
  if opts[:dry_run]
    return dry_run
  end

  if !opts[:force]
    printer.force_option_needed
    exit 64
  end

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

  printer.deleting_branches

  deleted_branches = cleaner.delete_merged_branches do |branch|
    printer.branch_info(branch_row(branch))
    true
  end

  if deleted_branches.empty?
    printer.no_branches_deleted
  else
    printer.done
  end
end