From 1ea9b37468b2cffc6c6c62dd767ab4d3956e54c7 Mon Sep 17 00:00:00 2001 From: Ben Connors Date: Tue, 3 Dec 2019 10:24:42 -0500 Subject: Interface fixes - Don't use italics if unavailable - Add more command-line options - Fix channels indexing from 1 in interface (now 0) --- interface/__main__.py | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'interface/__main__.py') diff --git a/interface/__main__.py b/interface/__main__.py index 878b263..b1267c8 100644 --- a/interface/__main__.py +++ b/interface/__main__.py @@ -1,12 +1,48 @@ +#!/usr/bin/env python3 + +import argparse as ap import datetime as dt import os import sys from .interface import Interface -from .ola import OLAOutput -#from .dummy import DummyOutput -if len(sys.argv) > 2: - raise ValueError("Usage: %s [workspace file]" % sys.argv[0]) +parser = ap.ArgumentParser(description="Curses interface for BLC2") +parser.add_argument("-o", "--output", default="ola", action="store", help="Select the output") +parser.add_argument("workspace", nargs='?', default=None, help="Workspace file to use") + +args = parser.parse_args() + +output = args.output.lower() +if output == "none": + class NoOutput: + name = "None" + + def set_values(self, values): + pass + + @property + def ok(self): + return True + + @property + def status(self): + return "Nothing's good" + + def __init__(self): + pass + + output = NoOutput() + +elif output == "dummy": + from .dummy import DummyOutput + + output = DummyOutput() +elif output == "ola": + from .ola import OLAOutput + + output = OLAOutput() +else: + raise ValueError("Unknown output \"%s\"" % output) -Interface(sys.argv[1] if len(sys.argv) == 2 else None, OLAOutput()).main() +Interface(args.workspace, output).main() -- cgit v1.2.3