]> git.ekhem.eu.org Git - gdrive_knife.git/commitdiff
Allow full argument names.
authorJakub Czajka <jakub@ekhem.eu.org>
Sun, 19 Nov 2023 12:25:06 +0000 (13:25 +0100)
committerJakub Czajka <jakub@ekhem.eu.org>
Sun, 19 Nov 2023 13:59:20 +0000 (14:59 +0100)
gdrive_knife.py

index 91782101fbca2a570994e32a16e5b03ef361040e..94945b281ecbfd30f3df31ecf46b9211c5ee0d7b 100644 (file)
@@ -229,56 +229,53 @@ if __name__ == '__main__':
 
     subparsers = parser.add_subparsers()
 
-    auth_parser = subparsers.add_parser('auth', help='Authenticate and obtain a '
+    auth_parser = subparsers.add_parser('auth', help='Obtain an authentication '
         'token.')
-    auth_parser.add_argument('-c', dest='credentials', required=True,
+    auth_parser.add_argument('-c', '--credentials', required=True,
         type=lambda x : file_path(parser, x), help='File with credentials.')
-    auth_parser.add_argument('-p', dest='port', type=int, default=8080,
-        help='Port on which the authentication server listens.')
-    auth_parser.add_argument('-r', dest='redirect_url',
-        default='http://localhost:8080', help='URL to redirect to after '
-        'successful after successful authentication.')
-    auth_parser.add_argument('-t', dest='token', default='token.json',
-        required=True, help='Path where the authentication token should be '
-        'saved.')
+    auth_parser.add_argument('-p', '--port', type=int, default=8080, help='Port '
+        'for the authentication server.')
+    auth_parser.add_argument('-r', '--redirect', default='http://localhost:8080',
+        help='URL to redirect to after successful authentication.')
+    auth_parser.add_argument('-t', '--token', default='token.json',
+        required=True, help='File with the authentication token (created if '
+        'missing).')
     auth_parser.set_defaults(func=auth)
 
     list_parser = subparsers.add_parser('list', help='List files.')
-    list_parser.add_argument('-t', dest='token', required=True,
+    list_parser.add_argument('-t', '--token', required=True,
         type=lambda x : file_path(parser, x), help='File with the '
         'authentication token.')
     list_parser.set_defaults(func=list)
 
     download_parser = subparsers.add_parser('download', help='Download a file.')
-    download_parser.add_argument('path', help='Path on the drive to download.')
-    download_parser.add_argument('output', help='Path where the file should be '
-        'saved.')
-    download_parser.add_argument('-k', dest='key', required=True,
-        type=lambda x : fernet_key(parser, x), help='File with the '
-        'decryption key.')
-    download_parser.add_argument('-t', dest='token', required=True,
+    download_parser.add_argument('path', help='File to download.')
+    download_parser.add_argument('output', help='Where to save the file.')
+    download_parser.add_argument('-k', '--key', required=True,
+        type=lambda x : fernet_key(parser, x), help='File with the decryption '
+        'key.')
+    download_parser.add_argument('-t', '--token', required=True,
         type=lambda x : file_path(parser, x), help='File with the '
         'authentication token.')
     download_parser.add_argument('--leave-as-archive', action='store_true',
-        help='Do not unarchive a directory after download.')
+        help='Skip unarchiving for directories.')
     download_parser.set_defaults(func=download)
 
-    upload_parser = subparsers.add_parser('upload', help='Upload a file. '
-        'Override if the file already exists.')
+    upload_parser = subparsers.add_parser('upload', help='Upload a file '
+        '(override if it exists).')
     upload_parser.add_argument('file', help='File to upload.')
-    upload_parser.add_argument('name', help='Name of the file on the drive.',
-        nargs='?')
-    upload_parser.add_argument('-k', dest='key', required=True,
-        type=lambda x : fernet_key(parser, x), help='File with the '
-        'decryption key.')
-    upload_parser.add_argument('-t', dest='token', required=True,
+    upload_parser.add_argument('name', help='Name on the drive.', nargs='?')
+    upload_parser.add_argument('-k', '--key', required=True,
+        type=lambda x : fernet_key(parser, x), help='File with the decryption '
+        'key.')
+    upload_parser.add_argument('-t', '--token', required=True,
         type=lambda x : file_path(parser, x), help='File with the '
         'authentication token.')
     upload_parser.set_defaults(func=upload)
 
     delete_parser = subparsers.add_parser('delete', help='Delete a file.')
-    delete_parser.add_argument('path', help='Path on the drive to delete.')
-    delete_parser.add_argument('-t', dest='token', required=True,
+    delete_parser.add_argument('path', help='File to delete.')
+    delete_parser.add_argument('-t', '--token', required=True,
         type=lambda x : file_path(parser, x), help='File with the '
         'authentication token.')
     delete_parser.set_defaults(func=delete)