summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmaan Bhojwani <me@armaanb.net>2021-01-30 22:28:01 -0500
committerArmaan Bhojwani <me@armaanb.net>2021-01-30 22:28:01 -0500
commit78fd63436a35dc5cf149c7140e88a1d682fc5fd8 (patch)
tree9165429d37a97e9e3275c8aaf1608c40c6cee318
parent858ff2d362ec23353de3e64b0abda1a6f8390a8a (diff)
downloadphrases-78fd63436a35dc5cf149c7140e88a1d682fc5fd8.tar.gz
Update argparse config to use built-in versioning
-rwxr-xr-xextract.py12
-rw-r--r--man/phrases-extract.12
-rw-r--r--man/phrases-extract.1.md2
-rw-r--r--man/phrases.12
-rw-r--r--man/phrases.1.md2
-rwxr-xr-xphrases.py10
6 files changed, 11 insertions, 19 deletions
diff --git a/extract.py b/extract.py
index 26fe9a8..4a0a6b0 100755
--- a/extract.py
+++ b/extract.py
@@ -15,8 +15,8 @@ def parse_args():
default="phrases.db",
help="set custom output file location")
parser.add_argument("-v", "--version",
- action="store_true",
- help="print script version")
+ action="version",
+ version="phrases-extract 1.0.3")
return parser.parse_args()
@@ -64,15 +64,11 @@ def get_tables():
def main():
- if args.version:
- print(version)
- else:
- prep_database()
- fill_database(get_tables())
+ prep_database()
+ fill_database(get_tables())
if __name__ == "__main__":
- version = "phrases extract.py 1.0.2"
args = parse_args()
conn = sqlite3.connect(args.output)
c = conn.cursor()
diff --git a/man/phrases-extract.1 b/man/phrases-extract.1
index ad2b3d0..921e1e1 100644
--- a/man/phrases-extract.1
+++ b/man/phrases-extract.1
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 2.11.3
.\"
-.TH "phrases-extract" "1" "January 2021" "1.0.2" ""
+.TH "phrases-extract" "1" "January 2021" "1.0.3" ""
.hy
.SH NAME
.PP
diff --git a/man/phrases-extract.1.md b/man/phrases-extract.1.md
index af554b9..464641f 100644
--- a/man/phrases-extract.1.md
+++ b/man/phrases-extract.1.md
@@ -1,4 +1,4 @@
-% phrases-extract(1) 1.0.2
+% phrases-extract(1) 1.0.3
% Armaan Bhojwani
% January 2021
diff --git a/man/phrases.1 b/man/phrases.1
index 3afe2e1..8fcfae9 100644
--- a/man/phrases.1
+++ b/man/phrases.1
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 2.11.3
.\"
-.TH "phrases" "1" "January 2021" "1.0.2" ""
+.TH "phrases" "1" "January 2021" "1.0.3" ""
.hy
.SH NAME
.PP
diff --git a/man/phrases.1.md b/man/phrases.1.md
index 3709d42..59b3ee0 100644
--- a/man/phrases.1.md
+++ b/man/phrases.1.md
@@ -1,4 +1,4 @@
-% phrases(1) 1.0.2
+% phrases(1) 1.0.3
% Armaan Bhojwani
% January 2021
diff --git a/phrases.py b/phrases.py
index 8f11be1..b1a3a90 100755
--- a/phrases.py
+++ b/phrases.py
@@ -25,8 +25,8 @@ def parse_args():
action='store_true',
help="print any notes on phrase")
parser.add_argument("-v", "--version",
- action='store_true',
- help="print version")
+ action='version',
+ version="phrases 1.0.3")
parser.add_argument("-m", "--min",
default=0,
type=int,
@@ -51,13 +51,10 @@ def output():
or args.latin
or args.english
or args.notes
- or args.num
- or args.version):
+ or args.num):
print(row[1])
exit(0)
else:
- if args.version:
- print(version)
if args.id:
print(row[0])
if args.latin:
@@ -93,7 +90,6 @@ def main():
if __name__ == "__main__":
- version = "phrases 1.0.2"
args = parse_args()
c = sqlite3.connect(find_file()).cursor()
main()