X-Git-Url: https://git.madduck.net/code/mailplate.git/blobdiff_plain/f7d2365ee0ab439217083dd613daa4757a4e3d6e..b6287ce4bbb2c7ca8d1056469fccf5eeb21e484c:/mailplate?ds=inline diff --git a/mailplate b/mailplate index 490ba8e..a26c8de 100755 --- a/mailplate +++ b/mailplate @@ -269,19 +269,27 @@ if options.debug: # 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): + 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 - elif os.access(os.path.join(TPATH, arg), os.R_OK): - # argument referenced an existing template - templname = arg else: - 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