make config command read-only

This commit is contained in:
Jörg Thalheim
2024-05-07 13:16:33 +02:00
parent 0eef21e2ef
commit c1e2bc9ea9
4 changed files with 13 additions and 78 deletions

View File

@@ -150,6 +150,15 @@ def read_machine_option_value(
return out
def get_option(args: argparse.Namespace) -> None:
print(
read_machine_option_value(
args.flake, args.machine, args.option, args.show_trace
)
)
# Currently writing is disabled
def get_or_set_option(args: argparse.Namespace) -> None:
if args.value == []:
print(
@@ -307,7 +316,7 @@ def register_parser(
)
# inject callback function to process the input later
parser.set_defaults(func=get_or_set_option)
parser.set_defaults(func=get_option)
parser.add_argument(
"--machine",
"-m",
@@ -345,13 +354,6 @@ def register_parser(
type=str,
)
parser.add_argument(
"value",
# force this arg to be set
nargs="*",
help="option value to set (if omitted, the current value is printed)",
)
def main(argv: list[str] | None = None) -> None:
if argv is None: