From 0c402d3754523eec48428e9b972511724c551b70 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Thu, 25 May 2023 14:12:45 -0700 Subject: [PATCH] Convert jq to templates --- dot_jq/{colors.jq => colors.jq.tmpl} | 2 ++ dot_jq/{env.jq => env.jq.tmpl} | 2 ++ dot_jq/{github.jq => github.jq.tmpl} | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) rename dot_jq/{colors.jq => colors.jq.tmpl} (87%) rename dot_jq/{env.jq => env.jq.tmpl} (92%) rename dot_jq/{github.jq => github.jq.tmpl} (95%) diff --git a/dot_jq/colors.jq b/dot_jq/colors.jq.tmpl similarity index 87% rename from dot_jq/colors.jq rename to dot_jq/colors.jq.tmpl index 6c9eddc..707681e 100644 --- a/dot_jq/colors.jq +++ b/dot_jq/colors.jq.tmpl @@ -1,3 +1,4 @@ +{{ if lookPath "jq" -}} def reset: "\u001b[0m"; def black: "\u001b[30m"; def white: "\u001b[97m"; @@ -7,3 +8,4 @@ def green: "\u001b[32m"; def yellow: "\u001b[33m"; def red: "\u001b[31m"; def magenta: "\u001b[35m"; +{{- end }} diff --git a/dot_jq/env.jq b/dot_jq/env.jq.tmpl similarity index 92% rename from dot_jq/env.jq rename to dot_jq/env.jq.tmpl index efb648d..8321398 100644 --- a/dot_jq/env.jq +++ b/dot_jq/env.jq.tmpl @@ -1,3 +1,4 @@ +{{ if lookPath "jq" -}} def browser: env.BROWSER; def editor: env.EDITOR; def home: env.HOME; @@ -12,3 +13,4 @@ def config: env.XDG_CONFIG_HOME; def data: env.XDG_DATA_HOME; def runtime: env.XDG_RUNTIME_DIR; def state: env.XDG_STATE_HOME; +{{- end }} diff --git a/dot_jq/github.jq b/dot_jq/github.jq.tmpl similarity index 95% rename from dot_jq/github.jq rename to dot_jq/github.jq.tmpl index 6d32ad8..040989d 100644 --- a/dot_jq/github.jq +++ b/dot_jq/github.jq.tmpl @@ -1,3 +1,4 @@ +{{ if lookPath "jq" -}} def by_time: sort_by(.created_at) | reverse; def asset($os; $arch): @@ -25,4 +26,4 @@ assets ] | join("\n") ) "; - +{{- end }}