示例#1
0
                    "--divider",
                    dest="divider",
                    help="Character that divides the sections (Default: '=')",
                    default="=",
                    type=str)
parser.add_argument("-w",
                    "--width",
                    dest="width",
                    help="Screen Width (Default: 100)",
                    default=100,
                    type=int)
args = parser.parse_args()

if not re.match("^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$", args.time):
    raise util.Failed(
        f"Argument Error: time argument invalid: {args.time} must be in the HH:MM format"
    )

util.separating_character = args.divider[0]
if 90 <= args.width <= 300:
    util.screen_width = args.width
else:
    raise util.Failed(
        f"Argument Error: width argument invalid: {args.width} must be an integer between 90 and 300"
    )

default_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                           "config")
if args.config and os.path.exists(args.config):
    default_dir = os.path.join(os.path.dirname(os.path.abspath(args.config)))
elif args.config and not os.path.exists(args.config):
    else:
        return default


my_tests = check_bool("PMM_TESTS", args.tests)
test = check_bool("PMM_TEST", args.test)
debug = check_bool("PMM_DEBUG", args.debug)
run = check_bool("PMM_RUN", args.run)
collections = os.environ.get("PMM_COLLECTIONS") if os.environ.get(
    "PMM_COLLECTIONS") else args.collections

time_to_run = os.environ.get("PMM_TIME") if os.environ.get(
    "PMM_TIME") else args.time
if not re.match("^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$", time_to_run):
    raise util.Failed(
        f"Argument Error: time argument invalid: {time_to_run} must be in the HH:MM format"
    )

util.separating_character = os.environ.get("PMM_DIVIDER")[0] if os.environ.get(
    "PMM_DIVIDER") else args.divider[0]

screen_width = os.environ.get("PMM_WIDTH") if os.environ.get(
    "PMM_WIDTH") else args.width
if 90 <= screen_width <= 300:
    util.screen_width = screen_width
else:
    raise util.Failed(
        f"Argument Error: width argument invalid: {screen_width} must be an integer between 90 and 300"
    )

config_file = os.environ.get("PMM_CONFIG") if os.environ.get(
                    "--divider",
                    dest="divider",
                    help="Character that divides the sections (Default: '=')",
                    default="=",
                    type=str)
parser.add_argument("-w",
                    "--width",
                    dest="width",
                    help="Screen Width (Default: 100)",
                    default=100,
                    type=int)
args = parser.parse_args()

if not re.match("^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$", args.time):
    raise util.Failed(
        "Argument Error: time argument invalid: {} must be in the HH:MM format"
        .format(args.time))

util.seperating_character = args.divider[0]
if 90 <= args.width <= 300:
    util.screen_width = args.width
else:
    raise util.Failed(
        "Argument Error: width argument invalid: {} must be an integer between 90 and 300"
        .format(args.width))

default_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                           "config")
if args.config and os.path.exists(args.config):
    default_dir = os.path.join(os.path.dirname(os.path.abspath(args.config)))
elif args.config and not os.path.exists(args.config):