forked from clan/clan-core
cmd.py refactor part 6
This commit is contained in:
parent
1a6983e031
commit
0c1d4a1d41
@ -1,7 +1,7 @@
|
||||
import argparse
|
||||
import json
|
||||
import subprocess
|
||||
|
||||
from ..cmd import Log, run
|
||||
from ..nix import nix_shell
|
||||
|
||||
|
||||
@ -30,21 +30,27 @@ def ssh(
|
||||
f"{user}@{host}",
|
||||
]
|
||||
cmd = nix_shell(packages, ["torify", *password_args, *_ssh_args])
|
||||
run(cmd, log=Log.BOTH)
|
||||
subprocess.run(cmd)
|
||||
|
||||
|
||||
def qrcode_scan(picture_file: str) -> str:
|
||||
return run(
|
||||
nix_shell(
|
||||
["nixpkgs#zbar"],
|
||||
[
|
||||
"zbarimg",
|
||||
"--quiet",
|
||||
"--raw",
|
||||
picture_file,
|
||||
],
|
||||
),
|
||||
).stdout.strip()
|
||||
return (
|
||||
subprocess.run(
|
||||
nix_shell(
|
||||
["nixpkgs#zbar"],
|
||||
[
|
||||
"zbarimg",
|
||||
"--quiet",
|
||||
"--raw",
|
||||
picture_file,
|
||||
],
|
||||
),
|
||||
stdout=subprocess.PIPE,
|
||||
check=True,
|
||||
)
|
||||
.stdout.decode()
|
||||
.strip()
|
||||
)
|
||||
|
||||
|
||||
def main(args: argparse.Namespace) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user