All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f7d2365)
If template 'foo' is being used in a directory where ./foo exists,
the argument parsing decides that ./foo must be the message to
rewrite and clobbers it.
Now there are more sanity checks in place, and I first try to determine
the template, then the file.
# parse the arguments
for arg in args:
if arg == '-':
# parse the arguments
for arg in args:
if arg == '-':
- # filename is -, so do nothing, since stdin/stdout are default
- continue
+ infname = arg
+ outfname = arg
+ elif arg.find(os.path.sep) == -1 and os.access(os.path.join(TPATH, arg), os.R_OK):
+ if templname is not None:
+ err("template already specified (%s), unsure what to do with '%s'"
+ % (templname, arg))
+ sys.exit(posix.EX_USAGE)
+ # argument references an existing template
+ templname = arg
elif os.path.isfile(arg):
elif os.path.isfile(arg):
+ if infname is not None:
+ err("input file already specified (%s), unsure what to do with '%s'"
+ % (infname, arg))
+ sys.exit(posix.EX_USAGE)
# the file exists, so use it as in/out if read/writeable
if os.access(arg, os.R_OK):
infname = arg
if os.access(arg, os.W_OK):
outfname = arg
# the file exists, so use it as in/out if read/writeable
if os.access(arg, os.R_OK):
infname = arg
if os.access(arg, os.W_OK):
outfname = arg
- elif os.access(os.path.join(TPATH, arg), os.R_OK):
- # argument referenced an existing template
- templname = arg
- err('unknown argument, and cannot find a template by this name: %s' % arg)
+ err('unknown argument: %s' % arg)
sys.exit(posix.EX_USAGE)
# sanity checks
sys.exit(posix.EX_USAGE)
# sanity checks