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

This commit is contained in:
2024-03-20 21:48:17 +01:00
parent 621832506c
commit 7f4d93f4d2
3 changed files with 30 additions and 19 deletions

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