diff options
author | Soispha <soispha@vhack.eu> | 2023-05-29 12:53:05 +0200 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-05-29 12:53:05 +0200 |
commit | 7d320b8492592e2dfe941ae2719f60e6a3daa0ba (patch) | |
tree | 7c1486d446496370a5fef1690512fd35bed50a66 /home-manager | |
parent | Fix(hm/conf/zsh): Also add a version for the shell library (diff) | |
download | nixos-config-7d320b8492592e2dfe941ae2719f60e6a3daa0ba.tar.gz nixos-config-7d320b8492592e2dfe941ae2719f60e6a3daa0ba.zip |
Feat(hm/conf/lf/cmds): Add a way to create temp scripts
Diffstat (limited to '')
-rw-r--r-- | home-manager/config/lf/commands/default.nix | 12 | ||||
-rwxr-xr-x | home-manager/config/lf/commands/scripts/mk_scr_default (renamed from home-manager/config/lf/commands/scripts/mk_scr) | 0 | ||||
-rwxr-xr-x | home-manager/config/lf/commands/scripts/mk_scr_temp | 31 | ||||
-rw-r--r-- | home-manager/config/lf/keybindings/default.nix | 3 |
4 files changed, 43 insertions, 3 deletions
diff --git a/home-manager/config/lf/commands/default.nix b/home-manager/config/lf/commands/default.nix index 27bf01db..a7cb2039 100644 --- a/home-manager/config/lf/commands/default.nix +++ b/home-manager/config/lf/commands/default.nix @@ -147,13 +147,21 @@ in { file = ./scripts/mk_ln; dependencies = []; }; - mk_scr = shell { - file = ./scripts/mk_scr; + mk_scr_default = shell { + file = ./scripts/mk_scr_default; dependencies = builtins.attrValues {inherit (pkgs) neovim;}; replacementStrings = { SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; }; }; + mk_scr_temp = shell { + file = ./scripts/mk_scr_temp; + dependencies = builtins.attrValues {inherit (pkgs) neovim;}; + replacementStrings = { + SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; + TO_BE_SHELL_LIBRARY_PATH = "%SHELL_LIBRARY_PATH"; # replacement is not recursive + }; + }; open = shell { file = ./scripts/open; dependencies = builtins.attrValues {inherit (pkgs) file xdg-utils neovim git;}; diff --git a/home-manager/config/lf/commands/scripts/mk_scr b/home-manager/config/lf/commands/scripts/mk_scr_default index 2f265aad..2f265aad 100755 --- a/home-manager/config/lf/commands/scripts/mk_scr +++ b/home-manager/config/lf/commands/scripts/mk_scr_default diff --git a/home-manager/config/lf/commands/scripts/mk_scr_temp b/home-manager/config/lf/commands/scripts/mk_scr_temp new file mode 100755 index 00000000..e8a92c5e --- /dev/null +++ b/home-manager/config/lf/commands/scripts/mk_scr_temp @@ -0,0 +1,31 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.3" . %SHELL_LIBRARY_PATH + + +prompt "Script name: " +name="" +while [ -z "$name" ] || [ -e "$name" ] +do + read -r name + if [ -e "$name" ]; then + prompt "Script already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Script Name: " + fi + fi +done + +script="$(pwd)"/"$name" + +sed 's|%TO_BE_SHELL_LIBRARY_PATH|%SHELL_LIBRARY_PATH|' "%SHELL_LIBRARY_TEMPLATE" > "$script" +chmod +x "$script" +"$VISUAL" "$script" + + +# vim: ft=sh diff --git a/home-manager/config/lf/keybindings/default.nix b/home-manager/config/lf/keybindings/default.nix index c3ac0ee2..42a337f9 100644 --- a/home-manager/config/lf/keybindings/default.nix +++ b/home-manager/config/lf/keybindings/default.nix @@ -55,7 +55,8 @@ mk = "mk_ln"; mf = "mk_file"; md = "mk_dir"; - ms = "mk_scr"; + ms = "mk_scr_default"; + mt = "mk_scr_temp"; ch = "chmod"; bg = "set_wall_paper"; |