summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2023-02-04 21:52:51 +0100
committertv <tv@krebsco.de>2023-02-05 02:29:31 +0100
commitafe16677affb35291fc64def0ccb0656a5c47647 (patch)
treed2de4f4a50538eedb92d33f4a44c59d3d905f79c /krebs
parent8056151181e6b49ad3c1b80cdfc94a18e49846fc (diff)
flameshot-once: add dev tools
Diffstat (limited to 'krebs')
-rw-r--r--krebs/5pkgs/simple/flameshot-once/config.nix8
-rw-r--r--krebs/5pkgs/simple/flameshot-once/default.nix78
2 files changed, 86 insertions, 0 deletions
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 '/\<iterableButtonTypes = {/,/^}/p' |
+ ${pkgs.gcc}/bin/cpp |
+ ${pkgs.coreutils}/bin/tr , \\n |
+ ${pkgs.gnused}/bin/sed -rn 's/^ *CaptureTool::(TYPE_[A-Z_]+).*/"\1"/p' |
+ ${pkgs.coreutils}/bin/sort |
+ ${placeholder "out"}/bin/prefix " $indent"
+ '';
+ };
+ "/bin/get-recognizedGeneralOptions" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ src=${cfg.package.src}/src/utils/confighandler.cpp
+ ${pkgs.coreutils}/bin/cat "$src" |
+ ${pkgs.gnused}/bin/sed -n '/\<recognizedGeneralOptions = {/,/^};/p' |
+ ${pkgs.gcc}/bin/cpp |
+ ${pkgs.gnugrep}/bin/grep -F OPTION |
+ ${pkgs.coreutils}/bin/sort
+ '';
+ };
+ "/bin/get-Shortcuts" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ indent=$(${placeholder "out"}/bin/indent-of Shortcuts)
+ src=${cfg.package.src}/src/utils/confighandler.cpp
+ ${pkgs.coreutils}/bin/cat "$src" |
+ ${pkgs.gnused}/bin/sed -n '/recognizedShortcuts = {/,/^};/p ' |
+ ${pkgs.gcc}/bin/cpp |
+ ${pkgs.gnused}/bin/sed -nr 's/^\s*SHORTCUT\("(TYPE_[^"]+).*/"\1"/p' |
+ ${pkgs.coreutils}/bin/sort |
+ ${placeholder "out"}/bin/prefix " $indent"
+ '';
+ };
+ "/bin/indent-of" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ # usage: indent-of NAME NIX_FILE
+ exec ${pkgs.gawk}/bin/awk -v name="$1" '
+ $1 == name && $2 == "=" {
+ sub("[^ ].*", "")
+ print
+ }
+ ' ${./config.nix}
+ '';
+ };
+ "/bin/prefix" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ ${pkgs.gawk}/bin/awk -v prefix="$1" '{ print prefix $0 }'
+ '';
+ };
+ };
+}