|
|
|
@ -87,12 +87,24 @@ def run_complete(shell: Union[None, str]):
|
|
|
|
|
|
|
|
|
|
def run_config(
|
|
|
|
|
config_filename: str,
|
|
|
|
|
context: Union[None, str] = None,
|
|
|
|
|
baseurl: Union[None, str] = None,
|
|
|
|
|
username: Union[None, str] = None,
|
|
|
|
|
password: Union[None, str] = None,
|
|
|
|
|
):
|
|
|
|
|
config = {"baseurl": baseurl, "username": username, "password": password}
|
|
|
|
|
needed = []
|
|
|
|
|
if context:
|
|
|
|
|
symlink = f'{config_filename}-{context}'
|
|
|
|
|
found = os.path.isfile(symlink)
|
|
|
|
|
if os.path.islink(config_filename):
|
|
|
|
|
os.remove(config_filename)
|
|
|
|
|
elif os.path.isfile(config_filename):
|
|
|
|
|
os.rename(config_filename, symlink)
|
|
|
|
|
os.symlink(symlink, config_filename)
|
|
|
|
|
config_filename = symlink
|
|
|
|
|
if found:
|
|
|
|
|
return
|
|
|
|
|
if not baseurl:
|
|
|
|
|
needed.append("baseurl")
|
|
|
|
|
if not username:
|
|
|
|
@ -245,6 +257,7 @@ def main() -> int:
|
|
|
|
|
|
|
|
|
|
configcmd = subparsers.add_parser("config")
|
|
|
|
|
configcmd.add_argument("-b", "--baseurl")
|
|
|
|
|
configcmd.add_argument("-c", "--context")
|
|
|
|
|
configcmd.add_argument("-p", "--password")
|
|
|
|
|
configcmd.add_argument("-u", "--username")
|
|
|
|
|
|
|
|
|
@ -288,7 +301,7 @@ def main() -> int:
|
|
|
|
|
mkdir(config_basepath)
|
|
|
|
|
|
|
|
|
|
if args.command == "config":
|
|
|
|
|
run_config(config_filename, args.baseurl, args.username, args.password)
|
|
|
|
|
run_config(config_filename, args.context, args.baseurl, args.username, args.password)
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
if not isfile(config_filename):
|
|
|
|
|