lib/git-up.rb in git-up-0.5.8 vs lib/git-up.rb in git-up-0.5.9
- old
+ new
@@ -1,10 +1,12 @@
require 'colored'
require 'grit'
class GitUp
- def run
+ def run(argv)
+ process_args(argv)
+
command = ['git', 'fetch', '--multiple']
command << '--prune' if prune?
command += config("fetch.all") ? ['--all'] : remotes
# puts command.join(" ") # TODO: implement a 'debug' config option
@@ -22,9 +24,37 @@
check_bundler
rescue GitError => e
puts e.message
exit 1
+ end
+
+ def process_args(argv)
+ banner = <<BANNER
+Fetch and rebase all remotely-tracked branches.
+
+ $ git up
+ master #{"up to date".green}
+ development #{"rebasing...".yellow}
+ staging #{"fast-forwarding...".yellow}
+ production #{"up to date".green}
+
+There are no command-line options, but there are a few
+`git config` variables you can set, which are documented here:
+#{"https://github.com/aanand/git-up#configuration".cyan}
+
+BANNER
+
+ case argv
+ when []
+ return
+ when ["-h"], ["--help"]
+ $stderr.puts(banner)
+ exit
+ else
+ $stderr.puts(banner)
+ exit 1
+ end
end
def rebase_all_branches
col_width = branches.map { |b| b.name.length }.max + 1