cmds.projects.CmdListRepos: Use new SSHClient API

Use SSHClient as an ExecContext, i.e. use the .run() method instead
of .run_cmd(). Also, let SSHClient decide which implementation to
use.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-03-18 05:53:14 +01:00
commit db9bf1826d

View file

@ -32,14 +32,14 @@ class CmdListRepos(Cmd): # export
match url.scheme:
case 'ssh':
if re.match(r'ssh://.*git\.janware\.com/', args.base_url):
from jw.pkg.lib.SSHClient import SSHClientCmd as SSHClient
ssh = SSHClient(hostname=url.hostname)
from jw.pkg.lib.SSHClient import ssh_client
ssh = ssh_client(args.base_url)
if username is not None:
ssh.set_username(username)
if password is not None:
ssh.set_password(password)
cmd = ['/opt/jw-pkg/bin/git-srv-admin.sh', '-u', args.from_owner, '-j', 'list-personal-projects']
stdout, stderr, code = await ssh.run_cmd(cmd)
stdout, stderr, code = await ssh.run(cmd)
print(stdout)
return
case 'https':