diff --git a/base/.jq/env.jq b/base/.jq/env.jq new file mode 100644 index 0000000..efb648d --- /dev/null +++ b/base/.jq/env.jq @@ -0,0 +1,14 @@ +def browser: env.BROWSER; +def editor: env.EDITOR; +def home: env.HOME; +def path: env.PATH | split(":"); +def pwd: env.PWD; +def term: env.TERM; +def user: env.USER; + +def bin: env.XDG_BIN_HOME; +def cache: env.XDG_CACHE_HOME; +def config: env.XDG_CONFIG_HOME; +def data: env.XDG_DATA_HOME; +def runtime: env.XDG_RUNTIME_DIR; +def state: env.XDG_STATE_HOME; diff --git a/base/.jq/github.jq b/base/.jq/github.jq new file mode 100644 index 0000000..6d32ad8 --- /dev/null +++ b/base/.jq/github.jq @@ -0,0 +1,28 @@ +def by_time: sort_by(.created_at) | reverse; + +def asset($os; $arch): + .assets[] + | select(.name | test($os)) + | select(.name | test($arch)) +; + +def latest: by_time | limit(1; .[]); +def latest_body: latest | .body; +def latest_version: latest | .tag_name; + +def latest_asset($os; $arch): latest | asset($os; $arch); +def latest_download($os; $arch): latest_asset($os; $arch) | .browser_download_url; +def latest_type($os; $arch): latest_asset($os; $arch) | .content_type; + +def summary($os; $arch): +"\((.name | select(. != "")) // .tag_name // .id) +created at: \(.created_at) +assets +\( + [ asset($os; $arch) + | .name + | " → \(.)" + ] | join("\n") +) +"; +