Skip to content

Commit

Permalink
extra cli debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
orgua committed Mar 24, 2023
1 parent 96f56bf commit 596cfaf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
7 changes: 7 additions & 0 deletions software/python-package/shepherd/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from periphery import GPIO

from . import ShepherdDebug
from . import __version__
from . import get_verbose_level
from . import run_emulator
from . import run_recorder
Expand Down Expand Up @@ -82,6 +83,12 @@ def cli(ctx: click.Context, verbose: int = 2):
Returns:
"""
set_verbose_level(verbose)
logger.info("Shepherd-Sheep v%s", __version__)
logger.debug("Python v%s", sys.version)
logger.debug("Click v%s", click.__version__)
if not ctx.invoked_subcommand:
click.echo("Please specify a valid command")

# test for correct usage -> fail early!
try:
sysfs_interface.get_mode()
Expand Down
10 changes: 9 additions & 1 deletion software/shepherd-calibration/shepherd_cal/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from datetime import datetime
from pathlib import Path
from time import time
Expand All @@ -8,6 +9,7 @@
import numpy as np
import yaml

from . import __version__
from .calibrator import INSTR_4WIRE
from .calibrator import INSTR_CAL_EMU
from .calibrator import INSTR_CAL_HRV
Expand All @@ -29,9 +31,15 @@
help="4 Levels",
)
@click.version_option()
@click.pass_context
# @click.pass_context
def cli(verbose: int):
def cli(ctx: click.Context, verbose: int):
set_verbose_level(verbose)
logger.info("Shepherd-Cal v%s", __version__)
logger.debug("Python v%s", sys.version)
logger.debug("Click v%s", click.__version__)
if not ctx.invoked_subcommand:
click.echo("Please specify a valid command")


# #############################################################################
Expand Down
9 changes: 8 additions & 1 deletion software/shepherd-herd/shepherd_herd/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import yaml
from fabric import Connection

from . import __version__
from .herd import Herd
from .herd import logger
from .herd import set_verbose_level
Expand Down Expand Up @@ -58,7 +59,7 @@ def cli(
user: Optional[str],
key_filepath: Optional[Path],
verbose: int,
) -> click.Context:
) -> click.Context: # TODO: return type can be removed?!?
"""A primary set of options to configure how to interface the herd
:param ctx:
Expand All @@ -70,6 +71,12 @@ def cli(
:return:
"""
set_verbose_level(verbose)
logger.info("Shepherd-Data v%s", __version__)
logger.debug("Python v%s", sys.version)
logger.debug("Click v%s", click.__version__)
if not ctx.invoked_subcommand:
click.echo("Please specify a valid command")

ctx.obj["herd"] = Herd(inventory, limit, user, key_filepath)
return ctx # calm linter

Expand Down

0 comments on commit 596cfaf

Please sign in to comment.