Add jq modules to base

main
Buddy Sandidge 3 years ago
parent 5d9ef094f2
commit b74b4d551f

@ -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;

@ -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")
)
";
Loading…
Cancel
Save