add feature to commit message
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
require_relative '../shared/branchability'
|
||||
require_relative '../shared/runnable'
|
||||
|
||||
module Commit
|
||||
|
||||
class Commander
|
||||
|
||||
include Shared::Branchability
|
||||
include Shared::Runnable
|
||||
|
||||
attr_reader :argv
|
||||
|
||||
def initialize (argv)
|
||||
@@ -19,10 +26,12 @@ module Commit
|
||||
end
|
||||
|
||||
def execute
|
||||
parts = parse_branch(current_branch)
|
||||
|
||||
comment = argv.reject { |x| x == '-m' }.join(' ')
|
||||
comment = "#{parts[:feature]}: #{comment}"
|
||||
|
||||
command = "git commit -m \"#{comment}\""
|
||||
exec command
|
||||
git_commit comment
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -58,6 +58,10 @@ module Shared
|
||||
def git_local_branch_create (branch)
|
||||
run_cmd "git checkout -b #{branch}"
|
||||
end
|
||||
|
||||
def git_commit (message)
|
||||
run_cmd "git commit -m \"#{message}\""
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user