Skip to content

Commit 60fac4f

Browse files
committed
add an argument to the cli tool to show the version.
1 parent 55e4879 commit 60fac4f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

textile/__main__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ def main():
1313
'accepts input as a file or stdin and can write out to '
1414
'a file or stdout.')
1515
parser = argparse.ArgumentParser(prog=prog, description=description)
16+
parser.add_argument('-v', '--version', action='store_true',
17+
help='show the version number and exit')
1618
parser.add_argument('infile', nargs='?', type=argparse.FileType(),
1719
help='a textile file to be converted')
1820
parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'),
1921
help='write the output of infile to outfile')
2022
options = parser.parse_args()
2123

24+
if options.version:
25+
print(textile.VERSION)
26+
sys.exit()
27+
2228
infile = options.infile or sys.stdin
2329
outfile = options.outfile or sys.stdout
2430
with infile:

0 commit comments

Comments
 (0)