From afe16677affb35291fc64def0ccb0656a5c47647 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 4 Feb 2023 21:52:51 +0100 Subject: flameshot-once: add dev tools --- krebs/5pkgs/simple/flameshot-once/config.nix | 8 +++ krebs/5pkgs/simple/flameshot-once/default.nix | 78 +++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/krebs/5pkgs/simple/flameshot-once/config.nix b/krebs/5pkgs/simple/flameshot-once/config.nix index 817c700a1..24df403aa 100644 --- a/krebs/5pkgs/simple/flameshot-once/config.nix +++ b/krebs/5pkgs/simple/flameshot-once/config.nix @@ -79,6 +79,8 @@ in }; settings = { # Options without a description are not documented in flameshot's README. + # Compare with: + # nix-shell -p flameshot-once.dev --run get-recognizedGeneralOptions General = mapAttrs (_: recursiveUpdate { default = null; }) { allowMultipleGuiInstances = mkOption { description = '' @@ -100,6 +102,8 @@ in }; buttons = let buttonTypes = { + # Generated with: + # nix-shell -p flameshot-once.dev --run get-buttonTypes TYPE_PENCIL = 0; TYPE_DRAWER = 1; TYPE_ARROW = 2; @@ -126,6 +130,8 @@ in TYPE_ACCEPT = 23; }; iterableButtonTypes = [ + # Generated with: + # nix-shell -p flameshot-once.dev --run get-iterableButtonTypes "TYPE_ACCEPT" "TYPE_ARROW" "TYPE_CIRCLE" @@ -359,6 +365,8 @@ in }; }; Shortcuts = genAttrs [ + # Generated with: + # nix-shell -p flameshot-once.dev --run get-Shortcuts "TYPE_ACCEPT" "TYPE_ARROW" "TYPE_CIRCLE" diff --git a/krebs/5pkgs/simple/flameshot-once/default.nix b/krebs/5pkgs/simple/flameshot-once/default.nix index 92dd5311f..3626409f3 100644 --- a/krebs/5pkgs/simple/flameshot-once/default.nix +++ b/krebs/5pkgs/simple/flameshot-once/default.nix @@ -69,3 +69,81 @@ pkgs.symlinkJoin { }) ]; } +// { + dev = pkgs.write "flameshot-once-tools" { + "/bin/get-buttonTypes" = { + executable = true; + text = /* sh */ '' + #! ${pkgs.dash}/bin/dash + indent=$(${placeholder "out"}/bin/indent-of buttonTypes) + src=${cfg.package.src}/src/tools/capturetool.h + ${pkgs.coreutils}/bin/cat "$src" | + ${pkgs.gnused}/bin/sed -nr ' + s/^\s*(TYPE_\S+)\s*=\s*([0-9]+),/\1 = \2;/p + ' | + ${placeholder "out"}/bin/prefix " $indent" + ''; + }; + "/bin/get-iterableButtonTypes" = { + executable = true; + text = /* sh */ '' + #! ${pkgs.dash}/bin/dash + indent=$(${placeholder "out"}/bin/indent-of iterableButtonTypes) + src=${cfg.package.src}/src/widgets/capture/capturetoolbutton.cpp + ${pkgs.coreutils}/bin/cat "$src" | + ${pkgs.gnused}/bin/sed -n '/\