def process_args(argv)
banner = "Fetch and rebase all remotely-tracked branches.\n\n $ git up\n master \#{\"up to date\".green}\n development \#{\"rebasing...\".yellow}\n staging \#{\"fast-forwarding...\".yellow}\n production \#{\"up to date\".green}\n\n $ git up --version # print version info\n $ git up --help # print this message\n\nThere are no interesting command-line options, but\nthere are a few `git config` variables you can set.\nFor info on those and more, check out the man page:\n\n $ git up man\n\nOr install it to your system, so you can get to it with\n`man git-up` or `git help up`:\n\n $ git up install-man\n\n"
man_path = File.expand_path('../../man/git-up.1', __FILE__)
case argv
when []
return
when ["-v"], ["--version"]
$stdout.puts "git-up #{GitUp::VERSION}"
exit
when ["man"]
system "man", man_path
exit
when ["install-man"]
destination = "/usr/local/share/man"
print "Destination to install man page to [#{destination}]: "
override = $stdin.gets.strip
destination = override if override.length > 0
dest_dir = File.join(destination, "man1")
dest_path = File.join(dest_dir, File.basename(man_path))
exit(1) unless system "mkdir", "-p", dest_dir
exit(1) unless system "cp", man_path, dest_path
puts "Installed to #{dest_path}"
exit
when ["-h"], ["--help"]
$stderr.puts(banner)
exit
else
$stderr.puts(banner)
exit 1
end
end