feature-add-trash: force the delete of a branch

This commit is contained in:
rkiel
2015-06-06 08:35:35 -04:00
parent f939991f6f
commit 067b1b3ccc
3 changed files with 42 additions and 0 deletions

37
lib/feature/trash.rb Normal file
View File

@@ -0,0 +1,37 @@
require_relative './base'
module Feature
class Trash < Feature::Base
def valid?
argv.size == 1
end
def help
puts
puts "USAGE: feature trash"
puts
exit
end
def execute
parts = parse_branch(current_branch)
standard_branch = parts[:standard]
feature_branch = current_branch
error "invalid feature branch: #{feature_branch}" if standard_branches.include? feature_branch
git_checkout standard_branch
git_local_branch_trash feature_branch
if remote_branch(feature_branch) != ""
git_remote_branch_delete feature_branch
end
git_prune
end
end
end