summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2009-12-27 19:53:52 +0100
committerTobias Klauser <tklauser@distanz.ch>2009-12-27 19:53:52 +0100
commit21c968ffbdb1d9617037b440d4d05758141e7604 (patch)
tree150d3b06d4da8b941598d9e0f7f88b09e9c6e303
parentf4b87447a74fa7ee76821bc5e4ddbd6e02b00303 (diff)
mkheader.py: Rename -p to -b
-rwxr-xr-xmkheader.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/mkheader.py b/mkheader.py
index 2a6c9ef..d74444b 100755
--- a/mkheader.py
+++ b/mkheader.py
@@ -18,15 +18,15 @@ import re
def usage():
print("""usage: %s [OPTION] FILE...
+ -b do not use full path for the guard name, just the basename
-e launch editor after creating files. Uses editor from $EDITOR envvar.
-f overwrite existing files
- -p do not include full path in header guard name, just the basename
-s print generated to stdout instead of writing it to file
-h show this help and exit""" % (os.path.basename(sys.argv[0])))
def main():
try:
- opts, args = getopt.getopt(sys.argv[1:], "efpsh")
+ opts, args = getopt.getopt(sys.argv[1:], "befsh")
except getopt.GetoptError, err:
print(str(err))
usage()
@@ -38,15 +38,15 @@ def main():
overwrite = False
launch_editor = False
- include_path = True
+ just_basename = False
to_stdout = False
for o, a in opts:
- if o == "-e":
+ if o == "-b":
+ just_basename = True
+ elif o == "-e":
launch_editor = True
elif o == "-f":
overwrite = True
- elif o == "-p":
- include_path = False
elif o == "-s":
to_stdout = True
elif o == "-h":
@@ -60,10 +60,10 @@ def main():
sys.exit(2)
for f in args:
- if include_path:
- s = f
- else:
+ if just_basename:
s = os.path.basename(f)
+ else:
+ s = f
if not to_stdout and not overwrite and os.path.exists(f):
print("Header file '%s' already exists. Use -f to override." % f)