Commit 6ea4af6f authored by Leon Riesebos's avatar Leon Riesebos
Browse files

core logger: improved frontend

parent 6a903e1e
Pipeline #292726128 passed with stage
in 2 minutes and 27 seconds
......@@ -123,14 +123,14 @@ def _get_args() -> argparse.Namespace:
"Source: https://www.m-labs.hk/artiq/manual/"
)
group = parser.add_argument_group('Core device')
group.add_argument('port', type=str, help='Serial port to connect to')
group.add_argument('--baud-rate', type=int, default=CoreLogger.DEFAULT_BAUD_RATE,
help=f'Baud rate (default: {CoreLogger.DEFAULT_BAUD_RATE})')
group = parser.add_argument_group('Output')
group.add_argument('--output-dir', type=str, default=CoreLogger.DEFAULT_OUTPUT_DIR,
help=f'Output directory (default: {CoreLogger.DEFAULT_OUTPUT_DIR})')
def baud_rate(arg: typing.Any) -> int:
try:
b = int(arg)
except ValueError:
raise argparse.ArgumentTypeError(f"invalid int value: '{arg}'")
if b not in serial.SerialBase.BAUDRATES:
raise argparse.ArgumentTypeError(f'not a valid baud rate: {b}')
return b
def positive_float(arg: typing.Any) -> float:
try:
......@@ -141,6 +141,15 @@ def _get_args() -> argparse.Namespace:
raise argparse.ArgumentTypeError(f'float value must be positive: {f}')
return f
group = parser.add_argument_group('Core device')
group.add_argument('port', type=str, help='Serial port to connect to')
group.add_argument('--baud-rate', type=baud_rate, default=CoreLogger.DEFAULT_BAUD_RATE,
help=f'Baud rate (default: {CoreLogger.DEFAULT_BAUD_RATE})')
group = parser.add_argument_group('Output')
group.add_argument('--output-dir', type=str, default=CoreLogger.DEFAULT_OUTPUT_DIR,
help=f'Output directory (default: "{CoreLogger.DEFAULT_OUTPUT_DIR}")')
group = parser.add_argument_group('Connection')
group.add_argument('--reconnect-delay', type=positive_float, default=CoreLogger.DEFAULT_RECONNECT_DELAY,
help=f'Delay before reconnecting in seconds (default: {CoreLogger.DEFAULT_RECONNECT_DELAY})')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment