Review shell scripts

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-01-22 14:07:22 +00:00
parent 8f94687b2b
commit bcbda92c46
27 changed files with 273 additions and 259 deletions

View File

@@ -20,16 +20,34 @@
in
''
nix-develop() {
if [ -z "$1" ]; then
echo "Usage: nix-develop <shell>"
return 1
local devshell=""
while getopts "s:" opt; do
case $opt in
s)
devshell=$OPTARG
;;
*)
echo "Usage: nix-develop [-s <devshell>]"
return 1
;;
esac
done
if [[ -z "$devshell" ]]; then
if [ ! -f flake.nix ]; then cp "${./template.nix}" flake.nix; fi
nix develop -c "$SHELL"
else
nix develop self#"$devshell" -c "$SHELL"
fi
nix develop self#"$1" -c "$SHELL"
}
_nix-develop_completion() {
local shells=(${devShells})
compadd -- $shells
local options=(
'-s[Dev shell from root flake]:shell:(${devShells})'
)
_arguments -s $options
}
compdef _nix-develop_completion nix-develop