From: Jakub Czajka Date: Sun, 19 Nov 2023 12:25:06 +0000 (+0100) Subject: Allow full argument names. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=a11144e004a16425f954b1d68cad16e4af135e3d;p=gdrive_knife.git Allow full argument names. --- diff --git a/gdrive_knife.py b/gdrive_knife.py index 9178210..94945b2 100644 --- a/gdrive_knife.py +++ b/gdrive_knife.py @@ -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)