Review shell scripts
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
_nix-install_completion() {
|
||||
local -a options
|
||||
options=(
|
||||
local options=(
|
||||
'1:flake:_directories'
|
||||
'-m[Mode: 'install' or 'repair']:mode:(install repair)'
|
||||
'-h[Host to configure]:host:($(_list_hosts))'
|
||||
@@ -11,16 +10,16 @@ _nix-install_completion() {
|
||||
)
|
||||
|
||||
_list_hosts() {
|
||||
flake="$(realpath ${words[2]})"
|
||||
if [[ -f "${flake}/flake.nix" ]]; then
|
||||
nix flake show --quiet --json "${flake}" 2>/dev/null | jq -r '.nixosConfigurations | keys[]'
|
||||
local flake="$(realpath ${words[2]})"
|
||||
if [[ -f "$flake/flake.nix" ]]; then
|
||||
nix flake show --quiet --json "$flake" 2>/dev/null | jq -r '.nixosConfigurations | keys[]'
|
||||
fi
|
||||
}
|
||||
|
||||
_list_keys() {
|
||||
flake="$(realpath ${words[2]})"
|
||||
if [[ -d "${flake}/secrets" ]]; then
|
||||
find "${flake}/secrets" -type f -name 'key.txt' | sed -E 's|^.*/secrets/([^/]+)/key.txt$|\1|' | sort -u
|
||||
local flake="$(realpath ${words[2]})"
|
||||
if [[ -d "$flake/secrets" ]]; then
|
||||
find "$flake/secrets" -type f -name 'key.txt' | sed -E 's|^.*/secrets/([^/]+)/key.txt$|\1|' | sort -u
|
||||
fi
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user