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