cmd.py refactor part 6
This commit is contained in:
@@ -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,11 +30,12 @@ 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 (
|
||||||
|
subprocess.run(
|
||||||
nix_shell(
|
nix_shell(
|
||||||
["nixpkgs#zbar"],
|
["nixpkgs#zbar"],
|
||||||
[
|
[
|
||||||
@@ -44,7 +45,12 @@ def qrcode_scan(picture_file: str) -> str:
|
|||||||
picture_file,
|
picture_file,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
).stdout.strip()
|
stdout=subprocess.PIPE,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
.stdout.decode()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def main(args: argparse.Namespace) -> None:
|
def main(args: argparse.Namespace) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user