From 9d4e1de936a675c8b3015a2750442d46842e3a75 Mon Sep 17 00:00:00 2001 From: Soispha Date: Sat, 25 Nov 2023 12:54:37 +0100 Subject: feat(hm/pkgs/scrs/con2pdf): Enable completions --- hm/soispha/pkgs/scripts.nix | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'hm/soispha/pkgs/scripts.nix') diff --git a/hm/soispha/pkgs/scripts.nix b/hm/soispha/pkgs/scripts.nix index 4a20eb55..fa7ba7ab 100644 --- a/hm/soispha/pkgs/scripts.nix +++ b/hm/soispha/pkgs/scripts.nix @@ -21,10 +21,23 @@ path = "apps"; dependencies = builtins.attrValues {inherit (pkgs) udisks gawk gnused gnugrep sudo;}; }; - con2pdf-scr = write_script { + con2pdf-scr = sysLib.writeShellScriptWithLibrary { name = "con2pdf"; - path = "apps"; + path = ./scripts/apps/con2pdf; dependencies = builtins.attrValues {inherit (pkgs) sane-backends imagemagick coreutils fd;}; + generateCompletions = true; + replacementStrings = { + DEVICE_FUNCTION = + # This is here, because escaping the whole function, to use it in the shell script + # directly just isn't possible + pkgs.writeText "DEVICE_FUNCTION" + /* + bash + */ + '' + scanimage -L | awk 'BEGIN { FS = "`" } { gsub(/'.*/, "", $2); print $2 }' + ''; + }; }; dldragon-scr = write_script { name = "dldragon"; -- cgit 1.4.1