Skip to content

Commit 6120e6b

Browse files
Add utils CLI group
1 parent cb081b3 commit 6120e6b

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

src/pyhf/cli/cli.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import click
55

66
from pyhf import __version__
7-
from pyhf.cli import rootio, spec, infer, patchset, complete
7+
from pyhf.cli import rootio, spec, infer, patchset, utils, complete
88
from pyhf.contrib import cli as contrib
9-
from pyhf import utils
9+
from pyhf.utils import citation
1010

1111
logging.basicConfig()
1212
log = logging.getLogger(__name__)
@@ -15,14 +15,7 @@
1515
def _print_citation(ctx, param, value):
1616
if not value or ctx.resilient_parsing:
1717
return
18-
click.echo(utils.citation())
19-
ctx.exit()
20-
21-
22-
def _debug(ctx, param, value):
23-
if not value or ctx.resilient_parsing:
24-
return
25-
click.echo(utils.debug_info())
18+
click.echo(citation())
2619
ctx.exit()
2720

2821

@@ -38,15 +31,6 @@ def _debug(ctx, param, value):
3831
expose_value=False,
3932
is_eager=True,
4033
)
41-
@click.option(
42-
"--debug",
43-
help="Produce OS / environment information useful for filing a bug report",
44-
default=False,
45-
is_flag=True,
46-
callback=_debug,
47-
expose_value=False,
48-
is_eager=True,
49-
)
5034
def pyhf():
5135
"""Top-level CLI entrypoint."""
5236

@@ -69,8 +53,8 @@ def pyhf():
6953

7054
pyhf.add_command(patchset.cli)
7155

56+
pyhf.add_command(utils.cli)
57+
7258
pyhf.add_command(complete.cli)
7359

7460
pyhf.add_command(contrib.cli)
75-
76-
# pyhf.add_command(utils.cli)

src/pyhf/cli/utils.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""The pyhf utils CLI subcommand."""
2+
import logging
3+
4+
import click
5+
from pyhf import utils
6+
7+
log = logging.getLogger(__name__)
8+
9+
10+
@click.group(name="utils")
11+
def cli():
12+
"""Utils CLI group."""
13+
14+
15+
@cli.command()
16+
def debug():
17+
click.echo(utils.debug_info())

0 commit comments

Comments
 (0)