Add config --list

pull/8/head
Johannes Jeppsson 4 months ago
parent 3787ad12df
commit 69a70bcd0e
Signed by untrusted user: YotaYota
GPG Key ID: 712C9B21DF0F25A2

@ -92,6 +92,7 @@ def run_config(
config_filename: str,
context: Union[None, str] = None,
baseurl: Union[None, str] = None,
list_config: bool = False,
username: Union[None, str] = None,
password: Union[None, str] = None,
):
@ -108,6 +109,12 @@ def run_config(
config_filename = symlink
if found:
return
if list_config:
config_data = get_config(config_filename)
config_data.pop("password", None)
output(config_data)
return
print("hope i'm not here")
if not baseurl:
needed.append("baseurl")
if not username:
@ -243,7 +250,6 @@ def split_url(url: str) -> dict:
"zone": zone,
}
# Entry point to program
def main() -> int:
description = """Manage DNS records with knot dns rest api:
@ -313,6 +319,7 @@ def main() -> int:
configcmd = subparsers.add_parser("config", description=config_description)
configcmd.add_argument("-b", "--baseurl")
configcmd.add_argument("-c", "--context")
configcmd.add_argument("-l", "--list", action="store_true")
configcmd.add_argument("-p", "--password")
configcmd.add_argument("-u", "--username")
@ -370,8 +377,8 @@ def main() -> int:
mkdir(config_basepath)
if args.command == "config":
run_config(config_filename, args.context, args.baseurl, args.username,
args.password)
run_config(config_filename, args.context, args.baseurl, args.list,
args.username, args.password)
return 0
if not isfile(config_filename):

Loading…
Cancel
Save