jw.pkg.cmds.projects.CmdGetAuthInfo: --remote-owner-base

Support --remote-owner-base in the command CmdGetAuthInfo. Make it
return what currently --remote-base returned: A URL including the
user / organization specific prefix of the Git remote's URL that
jw-pkg was pulled from.

   https://my-company.com/src/theowner/jw-pkg.git

would have a --remote-owner-base of

   https://my-company.com/src/theowner

Also, change what --remote-base returns to

   https://my-company.com/src

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-02-27 15:44:31 +01:00
commit 11379f4830

View file

@ -16,10 +16,16 @@ class CmdGetAuthInfo(Cmd): # export
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
super().add_arguments(parser) super().add_arguments(parser)
parser.add_argument('--only-values', help='Don\'t prefix values by "<field-name>="', action='store_true', default=False) parser.add_argument('--only-values', default=False, action='store_true',
parser.add_argument('--username', help='Show user name', action='store_true', default=False) help='Don\'t prefix values by "<field-name>="')
parser.add_argument('--password', help='Show password', action='store_true', default=False) parser.add_argument('--username', default=False, action='store_true',
parser.add_argument('--remote-base', help='Show remote base URL', action='store_true', default=False) help='Show user name')
parser.add_argument('--password', default=False, action='store_true',
help='Show password')
parser.add_argument('--remote-owner-base', default=False, action='store_true',
help='Show remote base URL for owner jw-pkg was cloned from')
parser.add_argument('--remote-base', default=False, action='store_true',
help='Show remote base URL')
async def _run(self, args: Namespace) -> None: async def _run(self, args: Namespace) -> None:
keys = ['username', 'password'] keys = ['username', 'password']
@ -40,7 +46,9 @@ class CmdGetAuthInfo(Cmd): # export
base = parsed.geturl() base = parsed.geturl()
base = re.sub(r'/jw-pkg', '', base) base = re.sub(r'/jw-pkg', '', base)
base = re.sub(r'/proj$', '', base) base = re.sub(r'/proj$', '', base)
result['remote_base'] = base base = re.sub(r'/proj$', '', base)
result['remote_owner_base'] = base
result['remote_base'] = os.path.dirname(base)
break break
# --- Print results # --- Print results