diff options
author | W. Trevor King <wking@drexel.edu> | 2009-12-07 07:25:18 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-12-07 07:25:18 -0500 |
commit | fada10afd00989bef0468373ae435234224390c1 (patch) | |
tree | 0ca037c4a5bb1af49042f5aa44972175368117a7 | |
parent | 0784330491a640f4e6016342b0bc2958d36b0b40 (diff) | |
download | bugseverywhere-fada10afd00989bef0468373ae435234224390c1.tar.gz |
Added --paginate and --no-pager to be
-rwxr-xr-x | be | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -22,7 +22,7 @@ import os import sys -from libbe import cmdutil, version +from libbe import cmdutil, version, pager __doc__ = cmdutil.help() @@ -36,6 +36,13 @@ parser.add_option("--verbose-version", action="store_true", dest="verbose_versio help="Print verbose version information and exit.") parser.add_option("-d", "--dir", dest="dir", metavar="DIR", default=".", help="Run this command on the repository in DIR instead of the current directory.") +parser.add_option("-p", "--paginate", dest="paginate", default=False, + action='store_true', + help="Pipe all output into less (or if set, $PAGER).") +parser.add_option("--no-pager", dest="no_pager", default=False, + action='store_true', + help="Do not pipe git output into a pager.") + try: options,args = parser.parse_args() @@ -57,10 +64,17 @@ if options.version == True or options.verbose_version == True: print version.version(verbose=options.verbose_version) sys.exit(0) +paginate = 'auto' +if options.paginate == True: + paginate = 'always' +if options.no_pager== True: + paginate = 'never' +pager.run_pager(paginate) + try: if len(args) == 0: raise cmdutil.UsageError, "must supply a command" - sys.exit(cmdutil.execute(args[0], args=args[1:], dir=dir)) + sys.exit(cmdutil.execute(args[0], args=args[1:], dir=options.dir)) except cmdutil.GetHelp: print cmdutil.help(args[0]) sys.exit(0) |