Skip to content

Commit

Permalink
more style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ianfhunter authored Nov 17, 2023
1 parent 884b22c commit 5875f39
Showing 1 changed file with 45 additions and 19 deletions.
64 changes: 45 additions & 19 deletions src/python/code/gnoll/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,57 @@ def parse_cmdline_args(args):
usage='python3 -m gnoll [options] EXPR',
add_help=False)


p.add_argument(
'EXPR',
'EXPR',
nargs='+',
help='a dice expression to evaluate (multiple arguments will be joined with spaces)'
help='a dice expression to evaluate'
'(multiple arguments will be joined with spaces)'
)

g = p.add_argument_group('main options')
g.add_argument('-h', '--help', action='help',
help='show this help message and exit')
g.add_argument('-b', '--breakdown', action='store_true',
help='show a breakdown into individual dice')
g.add_argument('--no-builtins', action='store_true',
help='disable built-in macros')
g.add_argument(
'-h',
'--help',
action='help',
help='show this help message and exit'
)
g.add_argument(
'-b',
'--breakdown',
action='store_true',
help='show a breakdown into individual dice'
)
g.add_argument(
'--no-builtins',
action='store_true',
help='disable built-in macros'
)

g = p.add_argument_group('debugging options')
g.add_argument('-v', '--verbose', action='store_true',
help='enable verbosity')
g.add_argument('--keep-temp-file', action='store_true',
help="don't delete the created temporary file")
g.add_argument('--mock', metavar='TYPE', type=int,
help='mocking type')
g.add_argument('--mock-const', metavar='N', type=int, default=3,
help='mocking constant')

g.add_argument(
'-v',
'--verbose',
action='store_true',
help='enable verbosity'
)
g.add_argument(
'--keep-temp-file',
action='store_true',
help="don't delete the created temporary file"
)
g.add_argument(
'--mock',
metavar='TYPE',

Check notice on line 57 in src/python/code/gnoll/__main__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/python/code/gnoll/__main__.py#L57

Trailing whitespace
type=int,
help='mocking type'
)
g.add_argument(
'--mock-const',
metavar='N',

Check notice on line 63 in src/python/code/gnoll/__main__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/python/code/gnoll/__main__.py#L63

Trailing whitespace
type=int,

Check notice on line 64 in src/python/code/gnoll/__main__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/python/code/gnoll/__main__.py#L64

Trailing whitespace
default=3,
help='mocking constant'
)

a = p.parse_args(args)
a.EXPR = ' '.join(a.EXPR)
Expand All @@ -54,7 +80,7 @@ def main(EXPR, no_builtins, **kwargs):
"""
_, [[result]], breakdown = gnoll.roll(
EXPR,
builtins = not no_builtins,
builtins=not no_builtins,
**kwargs)
if breakdown:
print(breakdown[0], '-->', result)
Expand Down

0 comments on commit 5875f39

Please sign in to comment.