utils/bin updates (socky, njs, github-releases)

This commit is contained in:
Jan Andrle 2024-03-20 21:48:17 +01:00
parent 621832506c
commit 7f4d93f4d2
Signed by: jaandrle
GPG Key ID: B3A25AED155AFFAB
3 changed files with 30 additions and 19 deletions

View File

@ -1,8 +1,3 @@
/* --print/--echo aliases */
Reflect.defineProperty($, "nosed", { get(){ return this.stdin.text(""); }, });
Reflect.defineProperty($, "nojq", { get(){ return this.stdin.json(null); }, });
Reflect.defineProperty($, "noawk", { get(){ return this.stdin.lines([]); }, });
/* deprecated/fallback */
globalThis.cyclicLoop= function*(items){
if(!items) items= 'win32'===process.platform ? '|/-\\' : "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏";
@ -16,3 +11,18 @@ globalThis.cyclicLoop= function*(items){
Reflect.defineProperty($, "clipboard", {
get(){ return s.$().run`xclip -o -selection clipboard`; }
})
// /** Custom uncaughtException function */
// export const uncaughtException= console.log;
// /** Place for custom code when script starts */
// export function onscript(){}
/** Place for custom code when REPL starts (`--interactive`) */
export function onrepl(){
Reflect.defineProperty(s, "jq", { get(){ return file=> s.cat(file).xargs(JSON.parse); } });
}
/** Place for custom code when eval starts (`--eval`/`--print`) */
export function oneval(){ /* --print/--echo aliases */
Reflect.defineProperty($, "nosed", { get(){ return this.stdin.text(""); }, });
Reflect.defineProperty($, "nojq", { get(){ return this.stdin.json(null); }, });
Reflect.defineProperty($, "noawk", { get(){ return this.stdin.lines([]); }, });
}

View File

@ -108,9 +108,9 @@
"group": "nondev",
"file_name": "upscayl",
"exec": "yes",
"last_update": "2024-02-10T12:17:10Z",
"last_update": "2024-02-29T16:31:09Z",
"downloads": "/home/jaandrle/bin/upscayl",
"version": "v2.9.9"
"version": "v2.10.0"
},
{
"repository": "RasmusLindroth/tut",
@ -152,9 +152,9 @@
"group": "nondev",
"file_name": "fedistar",
"exec": "yes",
"last_update": "2024-02-09T11:38:02Z",
"last_update": "2024-02-29T11:08:37Z",
"downloads": "/home/jaandrle/bin/fedistar",
"version": "v1.8.4"
"version": "v1.9.0"
},
{
"repository": "ollama/ollama",
@ -163,9 +163,9 @@
"group": "ai",
"file_name": "ollama",
"exec": "yes",
"last_update": "2024-02-22T22:55:46Z",
"last_update": "2024-03-10T02:24:04Z",
"downloads": "/home/jaandrle/bin/ollama",
"version": "v0.1.27"
"version": "v0.1.29"
},
{
"repository": "neovim/neovim",
@ -186,9 +186,9 @@
"group": "dev",
"file_name": "escrcpy",
"exec": "yes",
"last_update": "2023-12-27T01:18:21Z",
"last_update": "2024-03-13T03:05:48Z",
"downloads": "/home/jaandrle/bin/escrcpy",
"version": "v1.16.8"
"version": "v1.17.3"
},
{
"repository": "drovp/drovp",
@ -208,9 +208,9 @@
"group": "ai",
"file_name": "jan",
"exec": "yes",
"last_update": "2024-02-26T03:30:36Z",
"last_update": "2024-03-11T06:34:40Z",
"downloads": "/home/jaandrle/bin/jan",
"version": "v0.4.7"
"version": "v0.4.8"
}
]
}
}

View File

@ -2,15 +2,16 @@
/* jshint esversion: 11,-W097, -W040, module: true, node: true, expr: true, undef: true *//* global echo, $, pipe, s, fetch, cyclicLoop */
$.api("")
.version("2024-03-07")
.version("2024-03-18")
.command("silicon [file]", [
"Generovat obrázek s kódem pro sdílení na sociálních sítích. (alternativa k Carbon)",
"Toto je jen drobný wrapper s mými defaultními parametry.",
"Další nápověda viz `silicon --help`.",
])
.option("--title", "Set window title (default: file name).")
.option("--range", "Select lines from file in the form `start:end`")
.option("--font-size, --fs", "Font size", 25)
.action(function silicon(file, { range, fs, ["font-size"]: _fs, _, ...args }){
.action(function silicon(file, { title= file, range, fs, ["font-size"]: _fs, _, ...args }){
args= Object.assign({
theme: "OneHalfDark",
font: `Ubuntu Mono =${fs}`,
@ -27,7 +28,7 @@ $.api("")
const content= s.$().cat(file).toString().split(/\r?\n/).slice(...range.split(":").map(n=> parseInt(n)+1));
s.echo(content.join("\n")).to(from);
}
s.run`silicon ${from} --output ${output} --window-title ${file} ${args}`;
s.run`silicon ${from} --output ${output} --window-title ${title} ${args}`;
echo(`Generated ${output}`);
if(from!== file) s.rm(from);
$.exit(0);