CmdGetAuthInfo: Don't use non-git jw-build

Don't try to use non-git jw-build repositories to retrieve auth info.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-11-19 09:15:13 +01:00
commit f750b2cf05

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import re import re, os
from argparse import Namespace, ArgumentParser from argparse import Namespace, ArgumentParser
from urllib.parse import urlparse from urllib.parse import urlparse
@ -19,7 +19,11 @@ class CmdGetAuthInfo(Cmd): # export
parser.add_argument('--password', help='Show password', action='store_true', default=False) parser.add_argument('--password', help='Show password', action='store_true', default=False)
def _run(self, args: Namespace) -> None: def _run(self, args: Namespace) -> None:
remotes = run_cmd(['git', '-C', self.app.proj_dir('jw-build'), 'remote', '-v']) jw_build_dir = self.app.proj_dir('jw-build')
if not os.path.isdir(jw_build_dir + '/.git'):
self.app.debug(f'jw-build directory is not a Git repo: {jw_build_dir}')
return
remotes = run_cmd(['git', '-C', jw_build_dir, 'remote', '-v'])
result: dict[str, str] = {} result: dict[str, str] = {}
keys = ['username', 'password'] keys = ['username', 'password']
for line in remotes.split('\n'): for line in remotes.split('\n'):