Skip to content

Commit d93ac5b

Browse files
committed
Add debug flag to fireci
1 parent 56479ef commit d93ac5b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ci/fireci/fireci/internal.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ class _CommonOptions:
5858

5959

6060
@click.group()
61+
@click.option(
62+
'--debug/--no-debug',
63+
help='Set the min loglevel to debug.',
64+
default=False
65+
)
6166
@click.option(
6267
'--artifact-target-dir',
6368
default='_artifacts',
@@ -83,7 +88,7 @@ def main(options, **kwargs):
8388
setattr(options, k, v)
8489

8590

86-
def ci_command(name=None, cls=click.Command, group=main):
91+
def ci_command(name=None, cls=click.Command, group=main, epilog=None):
8792
"""Decorator to use for CI commands.
8893
8994
The differences from the standard @click.command are:
@@ -94,15 +99,19 @@ def ci_command(name=None, cls=click.Command, group=main):
9499
:param name: Optional name of the task. Defaults to the function name that is decorated with this decorator.
95100
:param cls: Specifies whether the func is a command or a command group. Defaults to `click.Command`.
96101
:param group: Specifies the group the command belongs to. Defaults to the `main` command group.
102+
:param epilog: Specifies epilog text to show at the end of the help text.
97103
"""
98104

99105
def ci_command(f):
100106
actual_name = f.__name__ if name is None else name
101107

102-
@click.command(name=actual_name, cls=cls, help=f.__doc__)
108+
@click.command(name=actual_name, cls=cls, help=f.__doc__, epilog=epilog)
103109
@_pass_options
104110
@click.pass_context
105111
def new_func(ctx, options, *args, **kwargs):
112+
if options.debug:
113+
logging.getLogger('fireci').setLevel(logging.DEBUG)
114+
106115
with _artifact_handler(
107116
options.artifact_target_dir,
108117
options.artifact_patterns,

0 commit comments

Comments
 (0)