cmd.py refactor part 6
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user