breakout commit
This commit is contained in:
13
bin/commit
13
bin/commit
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
raise "USAGE: commit [word....]" unless ARGV.size > 0
|
||||
require_relative '../lib/commit/commander'
|
||||
|
||||
comment = ARGV.reject { |x| x == '-m' }.join(' ')
|
||||
|
||||
command = "git commit -m \"#{comment}\""
|
||||
|
||||
exec command
|
||||
commander = Commit::Commander.new(ARGV)
|
||||
if commander.valid?
|
||||
commander.execute
|
||||
else
|
||||
commander.help
|
||||
end
|
||||
|
||||
30
lib/commit/commander.rb
Normal file
30
lib/commit/commander.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
module Commit
|
||||
|
||||
class Commander
|
||||
attr_reader :argv
|
||||
|
||||
def initialize (argv)
|
||||
@argv = argv
|
||||
end
|
||||
|
||||
def valid?
|
||||
argv.size > 0
|
||||
end
|
||||
|
||||
def help
|
||||
puts
|
||||
puts "USAGE: commit [word....]"
|
||||
puts
|
||||
exit
|
||||
end
|
||||
|
||||
def execute
|
||||
comment = argv.reject { |x| x == '-m' }.join(' ')
|
||||
|
||||
command = "git commit -m \"#{comment}\""
|
||||
exec command
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -4,7 +4,7 @@ module Feature
|
||||
|
||||
class End < Feature::Base
|
||||
def execute
|
||||
error "USAGE: feature end" unless ARGV.size == 1
|
||||
error "USAGE: feature end" unless argv.size == 1
|
||||
|
||||
parts = parse_branch(current_branch)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user