lib/grb.rb in grb-0.2.3 vs lib/grb.rb in grb-0.3.0
- old
+ new
@@ -68,16 +68,31 @@
'"#{GIT} merge #{origin}/#{branch}"',
]
},
:track => {
- :desc => "=> track branch\ngit track `branch` [--explain]",
+ :desc => "=> track branch\ngrb track `branch` [--explain]",
:commands => [
'"#{GIT} fetch #{origin}"',
'"#{GIT} branch --track #{branch} origin/#{branch}"',
'"#{GIT} checkout #{branch}"'
]
+ },
+
+ :remote_add => {
+ :desc => "=> add a remote repo\ngrb remote_add `name` `repo path` [--explain]",
+ :commands => [
+ '"#{GIT} remote add #{branch} #{branch_}"',
+ '"#{GIT} fetch #{branch}"'
+ ]
+ },
+
+ :remote_rm => {
+ :desc => "=> remove a remote repo\ngrb remote_rm `name` [--explain]",
+ :commands => [
+ '"#{GIT} remote rm #{branch}"',
+ ]
}
}
def self.parse(opt)
if COMMANDS.keys.include?(opt[:command].to_sym)
@@ -94,14 +109,14 @@
puts("\e[031m" + str.gsub(/^\s*/,'') + "\e[0m")
system("#{str}") unless EXPLAIN
end
def self.get_current_branch
- (`git branch 2> /dev/null | grep '^\*'`).gsub(/\W/,'')
+ (`#{GIT} branch 2> /dev/null | grep '^\*'`).gsub(/\W/,'')
end
def self.local_branches
- (`git branch -l`).split(/\n/).map{|x| x.gsub(/\W/,'')}
+ (`#{GIT} branch -l`).split(/\n/).map{|x| x.gsub(/\W/,'')}
end
def self.help(*args)
puts "USAGE:"
COMMANDS.values.map {|x| puts x[:desc].gsub(/^(\W.*)$/,"\e[31m" + '\1' + "\e[0m").gsub(/^(\w.*)$/,' $ \1')}