@kaynooo/cli-forgejo 0.30.1 → 0.30.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +86 -12
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -736,7 +736,7 @@ class Completing {
|
|
|
736
736
|
}
|
|
737
737
|
var completion = { active: false };
|
|
738
738
|
var OUTPUT_OPTIONS = {
|
|
739
|
-
color: { type: "string", description: "auto (on a terminal alone
|
|
739
|
+
color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
|
|
740
740
|
plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
|
|
741
741
|
};
|
|
742
742
|
function applyOutput(color, plain, env = process10.env) {
|
|
@@ -1369,6 +1369,66 @@ import { readFileSync as readFileSync4, realpathSync as realpathSync2 } from "fs
|
|
|
1369
1369
|
import { dirname as dirname3, join as join5 } from "path";
|
|
1370
1370
|
import process18 from "process";
|
|
1371
1371
|
|
|
1372
|
+
// ../kit/src/completions.ts
|
|
1373
|
+
var COMPLETION_SHELLS = ["fish", "bash", "zsh"];
|
|
1374
|
+
var FISH_FUNCTION = `functions -q __kaynooo_cli_complete; or function __kaynooo_cli_complete --argument-names bin --description 'what a @kaynooo/cli-kit bin offers for the word being typed'
|
|
1375
|
+
set -l tokens (commandline -xpc 2>/dev/null; or commandline -opc)
|
|
1376
|
+
set -l current (commandline -ct)
|
|
1377
|
+
for line in ($bin __complete $tokens[2..-1] $current 2>/dev/null)
|
|
1378
|
+
if test "$line" = __files__
|
|
1379
|
+
__fish_complete_path $current
|
|
1380
|
+
else
|
|
1381
|
+
echo $line
|
|
1382
|
+
end
|
|
1383
|
+
end
|
|
1384
|
+
end`;
|
|
1385
|
+
var BASH_FUNCTION = `__kaynooo_cli_complete() {
|
|
1386
|
+
local IFS=$'\\n' cur=\${COMP_WORDS[COMP_CWORD]} line words=
|
|
1387
|
+
local -a lines
|
|
1388
|
+
COMPREPLY=()
|
|
1389
|
+
lines=($("\${COMP_WORDS[0]}" __complete "\${COMP_WORDS[@]:1:COMP_CWORD}" 2>/dev/null))
|
|
1390
|
+
for line in "\${lines[@]}"; do
|
|
1391
|
+
if [[ $line == __files__ ]]; then
|
|
1392
|
+
COMPREPLY+=($(compgen -f -- "$cur"))
|
|
1393
|
+
else
|
|
1394
|
+
words+="\${line%%$'\\t'*}"$'\\n'
|
|
1395
|
+
fi
|
|
1396
|
+
done
|
|
1397
|
+
COMPREPLY+=($(compgen -W "$words" -- "$cur"))
|
|
1398
|
+
}`;
|
|
1399
|
+
var ZSH_FUNCTION = `__kaynooo_cli_complete() {
|
|
1400
|
+
local line
|
|
1401
|
+
local -a described plain
|
|
1402
|
+
for line in \${(f)"$("\${words[1]}" __complete "\${(@)words[2,CURRENT]}" 2>/dev/null)"}; do
|
|
1403
|
+
if [[ $line == __files__ ]]; then
|
|
1404
|
+
_files
|
|
1405
|
+
elif [[ $line == *$'\\t'* ]]; then
|
|
1406
|
+
described+=("\${\${line%%$'\\t'*}//:/\\\\:}:\${line#*$'\\t'}")
|
|
1407
|
+
else
|
|
1408
|
+
plain+=("$line")
|
|
1409
|
+
fi
|
|
1410
|
+
done
|
|
1411
|
+
(( \${#described} )) && _describe -V value described
|
|
1412
|
+
(( \${#plain} )) && compadd -- "\${plain[@]}"
|
|
1413
|
+
return 0
|
|
1414
|
+
}`;
|
|
1415
|
+
function completionScript(shell, bins, header = `# Generated by \`${bins[0]} --completions ${shell}\``) {
|
|
1416
|
+
if (shell === "fish")
|
|
1417
|
+
return `${header}
|
|
1418
|
+
${FISH_FUNCTION}
|
|
1419
|
+
${bins.map((bin) => `complete -c ${bin} -f -a '(__kaynooo_cli_complete ${bin})'
|
|
1420
|
+
`).join("")}`;
|
|
1421
|
+
if (shell === "bash")
|
|
1422
|
+
return `${header}
|
|
1423
|
+
${BASH_FUNCTION}
|
|
1424
|
+
complete -F __kaynooo_cli_complete ${bins.join(" ")}
|
|
1425
|
+
`;
|
|
1426
|
+
return `${header}
|
|
1427
|
+
${ZSH_FUNCTION}
|
|
1428
|
+
compdef __kaynooo_cli_complete ${bins.join(" ")}
|
|
1429
|
+
`;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1372
1432
|
// ../kit/src/notify.ts
|
|
1373
1433
|
import process16 from "process";
|
|
1374
1434
|
var NOTIFY_AFTER_MS = 1e4;
|
|
@@ -1442,7 +1502,11 @@ var LEVEL_OPTIONS = {
|
|
|
1442
1502
|
...OUTPUT_OPTIONS,
|
|
1443
1503
|
help: { type: "boolean", short: "h", description: "show this help" }
|
|
1444
1504
|
};
|
|
1445
|
-
var TOP_OPTIONS = {
|
|
1505
|
+
var TOP_OPTIONS = {
|
|
1506
|
+
...LEVEL_OPTIONS,
|
|
1507
|
+
version: { type: "boolean", short: "v", description: "print the version" },
|
|
1508
|
+
completions: { type: "string", choices: COMPLETION_SHELLS, description: "print the shell completion script" }
|
|
1509
|
+
};
|
|
1446
1510
|
async function commandRows(all, colors) {
|
|
1447
1511
|
const commands = shown(all);
|
|
1448
1512
|
const width = Math.max(0, ...Object.keys(commands).map((name) => name.length));
|
|
@@ -1682,6 +1746,19 @@ async function candidates(scope, defaultCommand, words, before = []) {
|
|
|
1682
1746
|
}
|
|
1683
1747
|
return "commands" in command ? candidates(scopeOf(command.commands, command.extraCommands, command.aliases), undefined, rest, [...before, word]) : leafCandidates(command.run, rest);
|
|
1684
1748
|
}
|
|
1749
|
+
var COMPLETIONS = "--completions";
|
|
1750
|
+
function flagValue([flag = "", ...rest]) {
|
|
1751
|
+
return flag.includes("=") ? [flag.slice(flag.indexOf("=") + 1), ...rest] : rest;
|
|
1752
|
+
}
|
|
1753
|
+
function printCompletionScript(name, args) {
|
|
1754
|
+
const shell = COMPLETION_SHELLS.find((each) => each === args[0]);
|
|
1755
|
+
if (shell === undefined || args.length !== 1) {
|
|
1756
|
+
printError(name, `${COMPLETIONS} takes one of ${COMPLETION_SHELLS.join(", ")}`, `${name} ${COMPLETIONS} fish`);
|
|
1757
|
+
return 2;
|
|
1758
|
+
}
|
|
1759
|
+
console.log(completionScript(shell, [name]).trimEnd());
|
|
1760
|
+
return 0;
|
|
1761
|
+
}
|
|
1685
1762
|
async function printCandidates(found) {
|
|
1686
1763
|
for (const line of await found)
|
|
1687
1764
|
console.log(line);
|
|
@@ -1706,6 +1783,8 @@ async function runCli(cli, argv = scriptArgs()) {
|
|
|
1706
1783
|
const version = cli.version ?? packageVersion();
|
|
1707
1784
|
if (argv[0] === COMPLETE)
|
|
1708
1785
|
return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
|
|
1786
|
+
if (argv[0] === COMPLETIONS || argv[0]?.startsWith(`${COMPLETIONS}=`) === true)
|
|
1787
|
+
return printCompletionScript(cli.name, flagValue(argv));
|
|
1709
1788
|
const started = performance.now();
|
|
1710
1789
|
const code = await dispatch({ path: [cli.name], header: (colors, about) => `${colors.bold(cli.name)} ${colors.dim(version)} ${about}`, summary: cli.about, ...scopeOf(cli.commands, cli.extraCommands, cli.aliases), defaultCommand: cli.defaultCommand, runBare: cli.runBare === true, examples: cli.examples, replaces: cli.replaces }, argv, { version, redact: cli.redact });
|
|
1711
1790
|
const command = commandPath(scopeOf(cli.commands, cli.extraCommands, cli.aliases), argv);
|
|
@@ -2686,7 +2765,6 @@ function standing(claim, sessions) {
|
|
|
2686
2765
|
return session === undefined ? { state: "away", claim } : { state: "taken", claim, session };
|
|
2687
2766
|
}
|
|
2688
2767
|
var NOTE_WIDTH = 100;
|
|
2689
|
-
var STATES = new Set(["available", "taken", "away"]);
|
|
2690
2768
|
function dimmed(text) {
|
|
2691
2769
|
return text === "" ? "" : paint(process.stdout).dim(text);
|
|
2692
2770
|
}
|
|
@@ -2775,7 +2853,7 @@ var boardOptions = {
|
|
|
2775
2853
|
labels: { type: "string", short: "L", description: "only issues with these labels, comma separated" },
|
|
2776
2854
|
milestone: { type: "string", short: "m", description: "only issues of this milestone, a title or an id" },
|
|
2777
2855
|
query: { type: "string", description: "only issues whose title matches this, a case-insensitive regex such as dom|eager" },
|
|
2778
|
-
state: { type: "string", description: "only issues in this state
|
|
2856
|
+
state: { type: "string", choices: ["available", "taken", "away"], description: "only issues in this state (away: claimed, no live session here)" },
|
|
2779
2857
|
...limitOptions(BOARD_LIMIT),
|
|
2780
2858
|
json: jsonOption("number, title, labels, state, holder, since, session, boxesTotal, boxesLeft and note (author, at, body of the latest comment that is not a claim)"),
|
|
2781
2859
|
watch: watchOption("the board"),
|
|
@@ -2788,8 +2866,6 @@ async function board(args) {
|
|
|
2788
2866
|
return watching(values.watch, async () => board(withoutWatch(args)));
|
|
2789
2867
|
const state = values.state;
|
|
2790
2868
|
const limit = limitOf(values, BOARD_LIMIT);
|
|
2791
|
-
if (state !== undefined && !STATES.has(state))
|
|
2792
|
-
fail(`--state takes available, taken or away, not ${state}`);
|
|
2793
2869
|
let query;
|
|
2794
2870
|
try {
|
|
2795
2871
|
query = values.query === undefined ? undefined : new RegExp(values.query, "i");
|
|
@@ -3329,12 +3405,12 @@ async function quietly(read) {
|
|
|
3329
3405
|
}
|
|
3330
3406
|
}
|
|
3331
3407
|
async function staleTodos() {
|
|
3332
|
-
const bin = Bun.which("
|
|
3408
|
+
const bin = Bun.which("src", { PATH: process27.env.PATH ?? "" });
|
|
3333
3409
|
if (bin === null)
|
|
3334
3410
|
return [];
|
|
3335
3411
|
let found;
|
|
3336
3412
|
try {
|
|
3337
|
-
const ran = await runCommand([bin, "--stale", "--json"]);
|
|
3413
|
+
const ran = await runCommand([bin, "todo-scan", "--stale", "--json"]);
|
|
3338
3414
|
found = JSON.parse(Buffer.concat(ran.chunks.filter((chunk) => chunk.stream === "stdout").map((chunk) => chunk.data)).toString());
|
|
3339
3415
|
} catch {
|
|
3340
3416
|
return [];
|
|
@@ -3961,7 +4037,7 @@ var listUsage = `ft milestones
|
|
|
3961
4037
|
Lists the repository's milestones, the open ones unless --state says otherwise, with the issues open and closed in each, the progress and the due date; on a terminal the progress is a bar, and --issues lists the title of every issue under its milestone.`;
|
|
3962
4038
|
var listExits = [[0, "it listed them"], [1, "Forgejo refuses"], [2, "a usage error"]];
|
|
3963
4039
|
var listOptions = {
|
|
3964
|
-
state: { type: "string",
|
|
4040
|
+
state: { type: "string", choices: ["open", "closed", "all"], default: "open", description: "which milestones to list (open)" },
|
|
3965
4041
|
issues: { type: "boolean", short: "i", description: "list the open and closed issues of each milestone by title" },
|
|
3966
4042
|
...limitOptions(LIST_LIMIT),
|
|
3967
4043
|
json: jsonOption("id, title, state, description, open, closed, due (YYYY-MM-DD or null)"),
|
|
@@ -3970,9 +4046,7 @@ var listOptions = {
|
|
|
3970
4046
|
async function milestones(args) {
|
|
3971
4047
|
const parsed = parse(args, listUsage, listOptions, { exits: listExits });
|
|
3972
4048
|
const { values } = parsed;
|
|
3973
|
-
const state = values.state
|
|
3974
|
-
if (state !== "open" && state !== "closed" && state !== "all")
|
|
3975
|
-
fail(`--state takes open, closed or all, not ${state}`);
|
|
4049
|
+
const state = values.state;
|
|
3976
4050
|
const limit = limitOf(values, LIST_LIMIT);
|
|
3977
4051
|
const found = await listMilestones(state, values.repo);
|
|
3978
4052
|
if (values.issues === true && values.json === true)
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-forgejo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.30.
|
|
4
|
+
"version": "0.30.3",
|
|
5
5
|
"description": "ft: Forgejo CI runs, logs, releases and issue checklists from the terminal, through tea.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://
|
|
8
|
+
"homepage": "https://github.com/Kayno0o/cli/tree/main/packages/ft#readme",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://
|
|
11
|
+
"url": "git+https://github.com/Kayno0o/cli.git",
|
|
12
12
|
"directory": "packages/ft"
|
|
13
13
|
},
|
|
14
|
-
"bugs": "https://
|
|
14
|
+
"bugs": "https://github.com/Kayno0o/cli/issues",
|
|
15
15
|
"keywords": ["forgejo", "gitea", "tea", "ci", "actions", "release"],
|
|
16
16
|
"bin": {
|
|
17
17
|
"ft": "./dist/cli.js"
|
|
@@ -31,6 +31,6 @@
|
|
|
31
31
|
"@kaynooo/utils": "3.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@kaynooo/cli-kit": "0.
|
|
34
|
+
"@kaynooo/cli-kit": "0.41.0"
|
|
35
35
|
}
|
|
36
36
|
}
|