add version command
authorOliver Matthews <oliver@codersoffortune.net>
Wed, 27 Nov 2019 11:41:58 +0000 (11:41 +0000)
committerOliver Matthews <oliver@codersoffortune.net>
Wed, 27 Nov 2019 11:41:58 +0000 (11:41 +0000)
README.md
thingy_grabber.py

index c5384ce..9349b19 100644 (file)
--- a/README.md
+++ b/README.md
@@ -3,14 +3,15 @@ Script for archiving thingiverse things. Due to this being a glorified webscrape
 
 ## Usage:
 ````
-usage: thingy_grabber.py [-h] [-v] [-d DIRECTORY] {collection,thing,user} ...
+usage: thingy_grabber.py [-h] [-v] [-d DIRECTORY] {collection,thing,user,version} ...
 
 positional arguments:
-  {collection,thing,user}
+  {collection,thing,user,version}
                         Type of thing to download
     collection          Download an entire collection
     thing               Download a single thing.
     user                Download all things by a user
+    version             Show the current version
 
 optional arguments:
   -h, --help            show this help message and exit
@@ -23,7 +24,6 @@ optional arguments:
 `thingy_grabber.py thing thingid`
 This will create a directory named after the title of the thing with the given ID and download the files into it.
 
-
 ### Collections
 `thingy_grabber.py collection user_name collection_name`
 Where `user_name` is the name of the creator of the collection (not nes. your name!) and `collection_name` is the name of the collection you want.
index a4842f7..bfa700f 100755 (executable)
@@ -23,6 +23,8 @@ LAST_PAGE_REGEX = re.compile(r'"last_page":(\d*),')
 PER_PAGE_REGEX = re.compile(r'"per_page":(\d*),')
 NO_WHITESPACE_REGEX = re.compile(r'[-\s]+')
 
+VERSION = "0.4.0"
+
 VERBOSE = False
 
 def strip_ws(value):
@@ -317,6 +319,7 @@ def main():
     thing_parser.add_argument("thing", help="Thing ID to download")
     user_parser = subparsers.add_parser("user", help="Download all things by a user")
     user_parser.add_argument("user", help="The user to get the designs of")
+    version_parser = subparsers.add_parser("version", help="Show the current version")
 
     args = parser.parse_args()
     if not args.subcommand:
@@ -337,8 +340,8 @@ def main():
         designs = Designs(args.user, args.directory)
         print(designs.get())
         designs.download()
-
-
+    if args.subcommand == "version":
+        print("thingy_grabber.py version {}".format(VERSION))
 
 if __name__ == "__main__":
     main()