Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix sysname to not display full path to command

  • Loading branch information...
commit 07c4537dca98f59c0ff80e6af7e54e119a636f7a 1 parent 43fcd1d
@piranha authored
Showing with 9 additions and 6 deletions.
  1. +4 −2 opster.py
  2. +5 −4 tests/opster.t
View
6 opster.py
@@ -473,7 +473,7 @@ def catcher(target, help_func):
help_func(e.args[0])
raise Abort()
except getopt.GetoptError, e:
- err('error: %s\n' % e)
+ err('error: %s\n\n' % e)
help_func()
raise Abort()
except OpsterError, e:
@@ -512,7 +512,9 @@ def replace_name(usage, name):
def sysname():
name = sys.argv[0]
- if name.startswith('./'):
@mrjoes
mrjoes added a note

Broken Windows support. Should be:

return name.rsplit(os.sep, 1)[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ if name.startswith('/'):
+ return name.rsplit('/', 1)[1]
+ elif name.startswith('./'):
return name[2:]
return name
View
9 tests/opster.t
@@ -8,7 +8,7 @@ Define some help functions::
Check if usage is working::
$ run multicommands.py
- usage: /Users/piranha/dev/misc/opster/tests/multicommands.py <command> [options]
+ usage: multicommands.py <command> [options]
commands:
@@ -23,7 +23,7 @@ Yeah, nice one, but we know that command ``complex`` is just hidden there. Let's
check it out::
$ run multicommands.py help complex
- /Users/piranha/dev/misc/opster/tests/multicommands.py complex [-p] [--exit value] ...
+ multicommands.py complex [-p] [--exit value] ...
That's more complex command intended to do something
@@ -44,7 +44,7 @@ everyone needs subcommands, you know)::
$ run test_opts.py
another: invalid arguments
- /Users/piranha/dev/misc/opster/tests/test_opts.py [-l HOST] DIR
+ test_opts.py [-l HOST] DIR
Command with option declaration as keyword arguments
@@ -71,7 +71,8 @@ Should we check passing some invalid arguments? I think so::
$ run test_opts.py --wrong-option
error: option --wrong-option not recognized
- /Users/piranha/dev/misc/opster/tests/test_opts.py [-l HOST] DIR
+
+ test_opts.py [-l HOST] DIR
Command with option declaration as keyword arguments
Please sign in to comment.
Something went wrong with that request. Please try again.