|
|
@ -7,7 +7,7 @@ import os
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
import urllib.parse
|
|
|
|
import urllib.parse
|
|
|
|
from os import environ, mkdir
|
|
|
|
from os import environ, mkdir
|
|
|
|
from os.path import isdir, isfile, join, split
|
|
|
|
from os.path import isdir, isfile, islink, join, split
|
|
|
|
from typing import Union
|
|
|
|
from typing import Union
|
|
|
|
from urllib.parse import urlparse
|
|
|
|
from urllib.parse import urlparse
|
|
|
|
|
|
|
|
|
|
|
@ -139,7 +139,15 @@ def run_config(
|
|
|
|
baseurl: Union[None, str] = None,
|
|
|
|
baseurl: Union[None, str] = None,
|
|
|
|
username: Union[None, str] = None,
|
|
|
|
username: Union[None, str] = None,
|
|
|
|
password: Union[None, str] = None,
|
|
|
|
password: Union[None, str] = None,
|
|
|
|
|
|
|
|
current: Union[None, str] = None,
|
|
|
|
):
|
|
|
|
):
|
|
|
|
|
|
|
|
if current:
|
|
|
|
|
|
|
|
if os.path.islink(config_filename):
|
|
|
|
|
|
|
|
actual_path = os.readlink(config_filename)
|
|
|
|
|
|
|
|
print(actual_path.split('-')[-1])
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("none")
|
|
|
|
|
|
|
|
return
|
|
|
|
config = {"baseurl": baseurl, "username": username, "password": password}
|
|
|
|
config = {"baseurl": baseurl, "username": username, "password": password}
|
|
|
|
needed = []
|
|
|
|
needed = []
|
|
|
|
if context:
|
|
|
|
if context:
|
|
|
@ -365,6 +373,7 @@ def main() -> int:
|
|
|
|
configcmd = subparsers.add_parser("config", description=config_description)
|
|
|
|
configcmd = subparsers.add_parser("config", description=config_description)
|
|
|
|
configcmd.add_argument("-b", "--baseurl")
|
|
|
|
configcmd.add_argument("-b", "--baseurl")
|
|
|
|
configcmd.add_argument("-c", "--context")
|
|
|
|
configcmd.add_argument("-c", "--context")
|
|
|
|
|
|
|
|
configcmd.add_argument("-C", "--current", action=argparse.BooleanOptionalAction)
|
|
|
|
configcmd.add_argument("-p", "--password")
|
|
|
|
configcmd.add_argument("-p", "--password")
|
|
|
|
configcmd.add_argument("-u", "--username")
|
|
|
|
configcmd.add_argument("-u", "--username")
|
|
|
|
|
|
|
|
|
|
|
@ -433,7 +442,7 @@ def main() -> int:
|
|
|
|
|
|
|
|
|
|
|
|
if args.command == "config":
|
|
|
|
if args.command == "config":
|
|
|
|
run_config(
|
|
|
|
run_config(
|
|
|
|
config_filename, args.context, args.baseurl, args.username, args.password
|
|
|
|
config_filename, args.context, args.baseurl, args.username, args.password, args.current
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|