Skip to content

Commit e26556d

Browse files
committed
Cleanup syntax of argparse
Make it easier on my eyes
1 parent f5ded51 commit e26556d

1 file changed

Lines changed: 34 additions & 20 deletions

File tree

scripts/sign_key

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,45 @@ if __name__ == '__main__':
3535
os.getenv('SSH_CA_CONFIG', '~/.ssh_ca/config'))
3636

3737
parser = argparse.ArgumentParser(__doc__)
38-
parser.add_argument('-a', '--authority', dest='authority',
39-
default=default_authority, help='Pick one: s3')
40-
parser.add_argument('-c', '--config', dest='config_file',
38+
parser.add_argument('-a', '--authority',
39+
dest='authority', default=default_authority,
40+
help='Pick one: s3',
41+
)
42+
parser.add_argument('-c', '--config-file',
4143
default=default_config,
4244
help='The configuration file to use. Can also be '
4345
'specified in the SSH_CA_CONFIG environment '
44-
'variable. Default: %(default)s')
45-
parser.add_argument('-e', '--environment', required=True,
46-
help='Environment name')
47-
parser.add_argument('--principal', action='append',
48-
help='A principal (username) that the user is allowed to use',)
49-
parser.add_argument(
50-
'-p', help='Path to public key. If set we try to upload this. '
51-
'Otherwise we try to download one.',
52-
dest='public_path')
53-
parser.add_argument(
54-
'-u', help='username / email address', required=True, dest='username')
55-
parser.add_argument(
56-
'--upload', help='Only upload the public key',
57-
dest='upload_only', action='store_true')
46+
'variable. Default: %(default)s',
47+
)
48+
parser.add_argument('-e', '--environment',
49+
required=True,
50+
help='Environment name',
51+
)
52+
parser.add_argument('--principal',
53+
action='append',
54+
help='A principal (username) that the user is allowed to use',
55+
)
56+
parser.add_argument('-p',
57+
dest='public_path',
58+
help='Path to public key. If set we try to upload this. '
59+
'Otherwise we try to download one.',
60+
)
61+
parser.add_argument('-u',
62+
required=True, dest='username',
63+
help='username / email address',
64+
)
65+
parser.add_argument('--upload',
66+
dest='upload_only', action='store_true',
67+
help='Only upload the public key',
68+
)
5869
parser.add_argument('-r', '--reason',
59-
help='Specify the reason for the user needing this cert.')
60-
parser.add_argument('-t', '--expires-in', default='+2h',
70+
help='Specify the reason for the user needing this cert.',
71+
)
72+
parser.add_argument('-t', '--expires-in',
73+
default='+2h',
6174
help='Expires in. A relative time like +1w. Or YYYYMMDDHHMMSS. '
62-
'Default: %(default)s')
75+
'Default: %(default)s',
76+
)
6377
args = parser.parse_args()
6478

6579
public_path = args.public_path

0 commit comments

Comments
 (0)