1
0
forked from clan/clan-core

cmd.py refactor part 6

This commit is contained in:
Luis Hebendanz 2024-01-12 17:21:48 +01:00
parent 1a6983e031
commit 0c1d4a1d41

View File

@ -1,7 +1,7 @@
import argparse import argparse
import json import json
import subprocess
from ..cmd import Log, run
from ..nix import nix_shell from ..nix import nix_shell
@ -30,21 +30,27 @@ def ssh(
f"{user}@{host}", f"{user}@{host}",
] ]
cmd = nix_shell(packages, ["torify", *password_args, *_ssh_args]) cmd = nix_shell(packages, ["torify", *password_args, *_ssh_args])
run(cmd, log=Log.BOTH) subprocess.run(cmd)
def qrcode_scan(picture_file: str) -> str: def qrcode_scan(picture_file: str) -> str:
return run( return (
nix_shell( subprocess.run(
["nixpkgs#zbar"], nix_shell(
[ ["nixpkgs#zbar"],
"zbarimg", [
"--quiet", "zbarimg",
"--raw", "--quiet",
picture_file, "--raw",
], picture_file,
), ],
).stdout.strip() ),
stdout=subprocess.PIPE,
check=True,
)
.stdout.decode()
.strip()
)
def main(args: argparse.Namespace) -> None: def main(args: argparse.Namespace) -> None: