clan-cli: deprecate nix_shell() in favor of run_cmd()

This commit is contained in:
DavHau
2024-07-16 13:48:55 +07:00
parent 0bcb9ae1c0
commit a598b878a5
24 changed files with 104 additions and 116 deletions

View File

@@ -5,7 +5,7 @@ from pathlib import Path
from typing import Any, Literal
from clan_cli.errors import ClanError
from clan_cli.nix import nix_shell, run_no_stdout
from clan_cli.nix import run_cmd, run_no_stdout
from . import API
@@ -117,7 +117,7 @@ def show_block_devices() -> Blockdevices:
Abstract api method to show block devices.
It must return a list of block devices.
"""
cmd = nix_shell(["nixpkgs#util-linux"], ["lsblk", "--json"])
cmd = run_cmd(["util-linux"], ["lsblk", "--json"])
proc = run_no_stdout(cmd)
res = proc.stdout.strip()

View File

@@ -3,7 +3,7 @@ import re
from dataclasses import dataclass
from clan_cli.cmd import run_no_stdout
from clan_cli.nix import nix_shell
from clan_cli.nix import run_cmd
from . import API
@@ -89,8 +89,8 @@ def parse_avahi_output(output: str) -> DNSInfo:
@API.register
def show_mdns() -> DNSInfo:
cmd = nix_shell(
["nixpkgs#avahi"],
cmd = run_cmd(
["avahi"],
[
"avahi-browse",
"--all",