From a5d68057d046dfb961768b79a054b7cfefcb43e3 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 26 Nov 2022 06:02:52 +0100 Subject: [PATCH] format --- searchers/home-manager-search.nix | 27 ++++++++++++-------- templates/package-preview-template-color.nix | 2 +- templates/package-preview-template.nix | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/searchers/home-manager-search.nix b/searchers/home-manager-search.nix index 7105f8d..f197076 100644 --- a/searchers/home-manager-search.nix +++ b/searchers/home-manager-search.nix @@ -37,7 +37,8 @@ let "([^>]*)" = "${red}$1${clear}"; "" = "\\n"; "]*)\"${s}/>" = "${blue}$1${clear}"; - "]*)\"${s}>([^<]*)" = "${bold}$2 ${clear}(${blue}$1${clear})"; + "]*)\"${s}>([^<]*)" = + "${bold}$2 ${clear}(${blue}$1${clear})"; "]*)\"${s}/>" = "${blue}$1${clear}"; }; @@ -83,13 +84,15 @@ let ${jq} -C ".\"$OPTION_KEY\"" $JSON_MANUAL_PATH ''; - previewGomplate = isColorized: let - # TODO: Color management here needs a refactoring badly... - pArgs = if isColorized then perlArgsColor else perlArgs; - colorSuffix = if isColorized then "-color" else ""; - batColorArg = if isColorized then "--color=always " else ""; - template = if isColorized then optionTemplateColor else optionTemplate; - in pkgs.writers.writeBash "preview-home-manager-attrs-gomplate${colorSuffix}" '' + previewGomplate = isColorized: + let + # TODO: Color management here needs a refactoring badly... + pArgs = if isColorized then perlArgsColor else perlArgs; + colorSuffix = if isColorized then "-color" else ""; + batColorArg = if isColorized then "--color=always " else ""; + template = if isColorized then optionTemplateColor else optionTemplate; + in pkgs.writers.writeBash + "preview-home-manager-attrs-gomplate${colorSuffix}" '' OPTION_KEY=$1 JSON_MANUAL_PATH=$2 @@ -169,9 +172,13 @@ in pkgs.writers.writeBash "search-home-manager-attrs" '' elif [ -v PRINT_JSON ]; then ${jq} -r 'keys | .[] | .' $JSON_MANUAL_PATH | ${fzf} --preview "${previewJson} {} $JSON_MANUAL_PATH" elif [ -v NO_COLOR ]; then - ${jq} -r 'keys | .[] | .' $JSON_MANUAL_PATH | ${fzf} --preview "${previewGomplate false} {} $JSON_MANUAL_PATH" + ${jq} -r 'keys | .[] | .' $JSON_MANUAL_PATH | ${fzf} --preview "${ + previewGomplate false + } {} $JSON_MANUAL_PATH" else - ${jq} -r 'keys | .[] | .' $JSON_MANUAL_PATH | ${fzf} --preview "${previewGomplate true} {} $JSON_MANUAL_PATH" + ${jq} -r 'keys | .[] | .' $JSON_MANUAL_PATH | ${fzf} --preview "${ + previewGomplate true + } {} $JSON_MANUAL_PATH" fi '' diff --git a/templates/package-preview-template-color.nix b/templates/package-preview-template-color.nix index d29b982..81b1588 100644 --- a/templates/package-preview-template-color.nix +++ b/templates/package-preview-template-color.nix @@ -1,3 +1,3 @@ # TODO: { pkgs, ... }: -pkgs.emptyFile \ No newline at end of file +pkgs.emptyFile diff --git a/templates/package-preview-template.nix b/templates/package-preview-template.nix index d29b982..81b1588 100644 --- a/templates/package-preview-template.nix +++ b/templates/package-preview-template.nix @@ -1,3 +1,3 @@ # TODO: { pkgs, ... }: -pkgs.emptyFile \ No newline at end of file +pkgs.emptyFile