Skip to content

Commit

Permalink
Help banner
Browse files Browse the repository at this point in the history
  • Loading branch information
aanand committed Jul 16, 2013
1 parent 7cafae1 commit e9b091c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/git-up
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

require 'git-up'

GitUp.new.run
GitUp.new.run(ARGV)

32 changes: 31 additions & 1 deletion lib/git-up.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
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
Expand All @@ -26,6 +28,34 @@ def run
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

Expand Down

0 comments on commit e9b091c

Please sign in to comment.