|
|
@ -73,8 +73,7 @@ If you see any prompts, that means that you have unset/incorrectly set variables
|
|
|
|
): # FAILSTATE Value is not one of the options
|
|
|
|
): # FAILSTATE Value is not one of the options
|
|
|
|
value = handle_input(
|
|
|
|
value = handle_input(
|
|
|
|
message=(
|
|
|
|
message=(
|
|
|
|
(("[blue]Example: " + str(checks["example"]) + "\n")
|
|
|
|
(("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "")
|
|
|
|
if "example" in checks else "")
|
|
|
|
|
|
|
|
+ "[red]"
|
|
|
|
+ "[red]"
|
|
|
|
+ ("Non-optional ", "Optional ")[
|
|
|
|
+ ("Non-optional ", "Optional ")[
|
|
|
|
"optional" in checks and checks["optional"] is True
|
|
|
|
"optional" in checks and checks["optional"] is True
|
|
|
@ -94,8 +93,7 @@ If you see any prompts, that means that you have unset/incorrectly set variables
|
|
|
|
): # FAILSTATE Value doesn't match regex, or has regex but is not a string.
|
|
|
|
): # FAILSTATE Value doesn't match regex, or has regex but is not a string.
|
|
|
|
value = handle_input(
|
|
|
|
value = handle_input(
|
|
|
|
message=(
|
|
|
|
message=(
|
|
|
|
(("[blue]Example: " + str(checks["example"]) + "\n")
|
|
|
|
(("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "")
|
|
|
|
if "example" in checks else "")
|
|
|
|
|
|
|
|
+ "[red]"
|
|
|
|
+ "[red]"
|
|
|
|
+ ("Non-optional ", "Optional ")[
|
|
|
|
+ ("Non-optional ", "Optional ")[
|
|
|
|
"optional" in checks and checks["optional"] is True
|
|
|
|
"optional" in checks and checks["optional"] is True
|
|
|
@ -116,14 +114,12 @@ If you see any prompts, that means that you have unset/incorrectly set variables
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if not hasattr(value, "__iter__") and (
|
|
|
|
if not hasattr(value, "__iter__") and (
|
|
|
|
("nmin" in checks and checks["nmin"]
|
|
|
|
("nmin" in checks and checks["nmin"] is not None and value < checks["nmin"])
|
|
|
|
is not None and value < checks["nmin"])
|
|
|
|
|
|
|
|
or ("nmax" in checks and checks["nmax"] is not None and value > checks["nmax"])
|
|
|
|
or ("nmax" in checks and checks["nmax"] is not None and value > checks["nmax"])
|
|
|
|
):
|
|
|
|
):
|
|
|
|
value = handle_input(
|
|
|
|
value = handle_input(
|
|
|
|
message=(
|
|
|
|
message=(
|
|
|
|
(("[blue]Example: " + str(checks["example"]) + "\n")
|
|
|
|
(("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "")
|
|
|
|
if "example" in checks else "")
|
|
|
|
|
|
|
|
+ "[red]"
|
|
|
|
+ "[red]"
|
|
|
|
+ ("Non-optional ", "Optional ")[
|
|
|
|
+ ("Non-optional ", "Optional ")[
|
|
|
|
"optional" in checks and checks["optional"] is True
|
|
|
|
"optional" in checks and checks["optional"] is True
|
|
|
@ -143,14 +139,12 @@ If you see any prompts, that means that you have unset/incorrectly set variables
|
|
|
|
else "Input out of bounds(Value too high/low/long/short)",
|
|
|
|
else "Input out of bounds(Value too high/low/long/short)",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if hasattr(value, "__iter__") and (
|
|
|
|
if hasattr(value, "__iter__") and (
|
|
|
|
("nmin" in checks and checks["nmin"]
|
|
|
|
("nmin" in checks and checks["nmin"] is not None and len(value) < checks["nmin"])
|
|
|
|
is not None and len(value) < checks["nmin"])
|
|
|
|
|
|
|
|
or ("nmax" in checks and checks["nmax"] is not None and len(value) > checks["nmax"])
|
|
|
|
or ("nmax" in checks and checks["nmax"] is not None and len(value) > checks["nmax"])
|
|
|
|
):
|
|
|
|
):
|
|
|
|
value = handle_input(
|
|
|
|
value = handle_input(
|
|
|
|
message=(
|
|
|
|
message=(
|
|
|
|
(("[blue]Example: " + str(checks["example"]) + "\n")
|
|
|
|
(("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "")
|
|
|
|
if "example" in checks else "")
|
|
|
|
|
|
|
|
+ "[red]"
|
|
|
|
+ "[red]"
|
|
|
|
+ ("Non-optional ", "Optional ")[
|
|
|
|
+ ("Non-optional ", "Optional ")[
|
|
|
|
"optional" in checks and checks["optional"] is True
|
|
|
|
"optional" in checks and checks["optional"] is True
|
|
|
@ -172,8 +166,7 @@ If you see any prompts, that means that you have unset/incorrectly set variables
|
|
|
|
if value == {}:
|
|
|
|
if value == {}:
|
|
|
|
handle_input(
|
|
|
|
handle_input(
|
|
|
|
message=(
|
|
|
|
message=(
|
|
|
|
(("[blue]Example: " + str(checks["example"]) + "\n")
|
|
|
|
(("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "")
|
|
|
|
if "example" in checks else "")
|
|
|
|
|
|
|
|
+ "[red]"
|
|
|
|
+ "[red]"
|
|
|
|
+ ("Non-optional ", "Optional ")[
|
|
|
|
+ ("Non-optional ", "Optional ")[
|
|
|
|
"optional" in checks and checks["optional"] is True
|
|
|
|
"optional" in checks and checks["optional"] is True
|
|
|
@ -252,7 +245,7 @@ Creating it now."""
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
crawl(template, check_vars)
|
|
|
|
crawl(template, check_vars)
|
|
|
|
pretty.pprint(config)
|
|
|
|
# pretty.pprint(config)
|
|
|
|
with open(config_file, "w") as f:
|
|
|
|
with open(config_file, "w") as f:
|
|
|
|
toml.dump(config, f)
|
|
|
|
toml.dump(config, f)
|
|
|
|
return True
|
|
|
|
return True
|
|
|
|