forgemap 0.7.0-dev.128-e6bed71 → 0.7.0-dev.129-714bb16
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/README.md +1 -0
- package/dist/bin/forgemap.mjs +31 -14
- package/dist/bin/forgemap.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,6 +88,7 @@ Prints where a repo lives — or *would* live, if it isn't cloned yet, which mak
|
|
|
88
88
|
forgemap list # every repo as a pretty tree
|
|
89
89
|
forgemap list forgemap # pretty tree (one line per match)
|
|
90
90
|
forgemap list forgemap | fzf # pipe-friendly path output
|
|
91
|
+
forgemap ls # `ls` is an alias for `list`
|
|
91
92
|
forgemap pick # interactive picker (consola prompt)
|
|
92
93
|
forgemap pick kirch # picker pre-filtered by fuzzy query
|
|
93
94
|
```
|
package/dist/bin/forgemap.mjs
CHANGED
|
@@ -3243,7 +3243,7 @@ var infoCommand = defineCommand({
|
|
|
3243
3243
|
async run({ args }) {
|
|
3244
3244
|
const binary = resolveBinary(process.argv[1]);
|
|
3245
3245
|
const info = {
|
|
3246
|
-
version: "0.7.0-dev.
|
|
3246
|
+
version: "0.7.0-dev.129-714bb16",
|
|
3247
3247
|
build: detectBuild(binary.resolved),
|
|
3248
3248
|
binary,
|
|
3249
3249
|
node: process.version,
|
|
@@ -3369,6 +3369,7 @@ function renderTree$1(repos) {
|
|
|
3369
3369
|
var listCommand = defineCommand({
|
|
3370
3370
|
meta: {
|
|
3371
3371
|
name: "list",
|
|
3372
|
+
alias: "ls",
|
|
3372
3373
|
description: "List cloned repos; with a query, fuzzy-match by owner/repo and print matches"
|
|
3373
3374
|
},
|
|
3374
3375
|
args: {
|
|
@@ -4219,6 +4220,21 @@ var SHELL_POSITIONAL = /* @__PURE__ */ new Set(["completion", "shell-init"]);
|
|
|
4219
4220
|
function argsOf(cmd) {
|
|
4220
4221
|
return cmd.args ?? {};
|
|
4221
4222
|
}
|
|
4223
|
+
/** Subcommand aliases, read off citty's own `meta.alias` so the completion and
|
|
4224
|
+
* the dispatcher cannot disagree about what `ls` means. Every forgemap command
|
|
4225
|
+
* declares `meta` as a plain object literal, never a thunk. */
|
|
4226
|
+
function aliasesOf(cmd) {
|
|
4227
|
+
const alias = cmd.meta?.alias;
|
|
4228
|
+
if (!alias) return [];
|
|
4229
|
+
return Array.isArray(alias) ? [...alias] : [alias];
|
|
4230
|
+
}
|
|
4231
|
+
/** Every name that reaches a command on the command line: its own, plus its
|
|
4232
|
+
* aliases. This is what the *recognition* arms key on — `commandSpecs()`'s
|
|
4233
|
+
* `name` alone is what the depth-1 *suggestion* list offers, which is how an
|
|
4234
|
+
* alias completes its arguments without being advertised as a command. */
|
|
4235
|
+
function namesOf(spec) {
|
|
4236
|
+
return [spec.name, ...spec.aliases];
|
|
4237
|
+
}
|
|
4222
4238
|
/** Flag names a command exposes, derived from its `defineCommand` args so a new
|
|
4223
4239
|
* flag surfaces in completion automatically. Positionals are handled
|
|
4224
4240
|
* separately; negatable booleans (those with a `negativeDescription`) also get
|
|
@@ -4257,6 +4273,7 @@ function commandSpecs() {
|
|
|
4257
4273
|
["forge", forgeCommand]
|
|
4258
4274
|
].map(([name, cmd]) => ({
|
|
4259
4275
|
name,
|
|
4276
|
+
aliases: aliasesOf(cmd),
|
|
4260
4277
|
flags: flagsOf(cmd),
|
|
4261
4278
|
flagValues: STATIC_FLAG_VALUES[name] ?? {},
|
|
4262
4279
|
positionalValues: SHELL_POSITIONAL.has(name) ? [...SUPPORTED_SHELLS] : [],
|
|
@@ -4264,17 +4281,17 @@ function commandSpecs() {
|
|
|
4264
4281
|
}));
|
|
4265
4282
|
}
|
|
4266
4283
|
function flagValuePairs(specs) {
|
|
4267
|
-
return specs.flatMap((s) => Object.entries(s.flagValues).map(([flag, values]) => [
|
|
4268
|
-
|
|
4284
|
+
return specs.flatMap((s) => namesOf(s).flatMap((name) => Object.entries(s.flagValues).map(([flag, values]) => [
|
|
4285
|
+
name,
|
|
4269
4286
|
flag,
|
|
4270
4287
|
values
|
|
4271
|
-
]));
|
|
4288
|
+
])));
|
|
4272
4289
|
}
|
|
4273
4290
|
function renderBash(specs) {
|
|
4274
4291
|
const names = specs.map((s) => s.name).join(" ");
|
|
4275
4292
|
const valueArms = flagValuePairs(specs).map(([cmd, flag, values]) => ` ${cmd}:${flag}) COMPREPLY=( $(compgen -W "${values.join(" ")}" -- "$cur") ); return ;;`).join("\n");
|
|
4276
|
-
const flagArms = specs.filter((s) => s.flags.length > 0).
|
|
4277
|
-
const slugCmds = specs.filter((s) => s.slugs).
|
|
4293
|
+
const flagArms = specs.filter((s) => s.flags.length > 0).flatMap((s) => namesOf(s).map((name) => ` ${name}) flags="${s.flags.join(" ")}" ;;`)).join("\n");
|
|
4294
|
+
const slugCmds = specs.filter((s) => s.slugs).flatMap(namesOf);
|
|
4278
4295
|
return `# forgemap bash completion — drop into your ~/.bashrc:
|
|
4279
4296
|
# eval "$(forgemap completion bash)"
|
|
4280
4297
|
_forgemap_completion() {
|
|
@@ -4309,7 +4326,7 @@ ${[slugCmds.length > 0 ? ` ${slugCmds.join("|")})
|
|
|
4309
4326
|
local slugs
|
|
4310
4327
|
slugs=$(forgemap list --format slug 2>/dev/null)
|
|
4311
4328
|
COMPREPLY=( $(compgen -W "$slugs" -- "$cur") )
|
|
4312
|
-
;;` : "", ...specs.filter((s) => s.positionalValues.length > 0).map((s) => ` ${s.
|
|
4329
|
+
;;` : "", ...specs.filter((s) => s.positionalValues.length > 0).map((s) => ` ${namesOf(s).join("|")}) COMPREPLY=( $(compgen -W "${s.positionalValues.join(" ")}" -- "$cur") ) ;;`)].filter(Boolean).join("\n")}
|
|
4313
4330
|
esac
|
|
4314
4331
|
}
|
|
4315
4332
|
complete -F _forgemap_completion forgemap
|
|
@@ -4338,19 +4355,19 @@ ${flagValuePairs(specs).map(([cmd, flag, values]) => ` ${cmd}:${flag}) compad
|
|
|
4338
4355
|
# Flag names for the current subcommand.
|
|
4339
4356
|
if [[ "$cur" == -* ]]; then
|
|
4340
4357
|
case "$cmd" in
|
|
4341
|
-
${specs.filter((s) => s.flags.length > 0).
|
|
4358
|
+
${specs.filter((s) => s.flags.length > 0).flatMap((s) => namesOf(s).map((name) => ` ${name}) compadd -- ${s.flags.join(" ")}; return ;;`)).join("\n")}
|
|
4342
4359
|
esac
|
|
4343
4360
|
return
|
|
4344
4361
|
fi
|
|
4345
4362
|
|
|
4346
4363
|
# Positional values (repo slugs, or a shell name).
|
|
4347
4364
|
case "$cmd" in
|
|
4348
|
-
${specs.filter((s) => s.slugs).
|
|
4365
|
+
${specs.filter((s) => s.slugs).flatMap(namesOf).join("|")})
|
|
4349
4366
|
local -a slugs
|
|
4350
4367
|
slugs=("\${(@f)$(forgemap list --format slug 2>/dev/null)}")
|
|
4351
4368
|
_describe 'slug' slugs
|
|
4352
4369
|
;;
|
|
4353
|
-
${specs.filter((s) => s.positionalValues.length > 0).map((s) => ` ${s.
|
|
4370
|
+
${specs.filter((s) => s.positionalValues.length > 0).map((s) => ` ${namesOf(s).join("|")}) compadd ${s.positionalValues.join(" ")} ;;`).join("\n")}
|
|
4354
4371
|
esac
|
|
4355
4372
|
}
|
|
4356
4373
|
compdef _forgemap forgemap
|
|
@@ -4362,7 +4379,7 @@ function renderFish(specs) {
|
|
|
4362
4379
|
const long = flag.replace(/^--/, "");
|
|
4363
4380
|
const values = s.flagValues[flag];
|
|
4364
4381
|
const valuePart = values ? ` -x -a '${values.join(" ")}'` : "";
|
|
4365
|
-
return `complete -c forgemap -n '__fish_seen_subcommand_from ${s.
|
|
4382
|
+
return `complete -c forgemap -n '__fish_seen_subcommand_from ${namesOf(s).join(" ")}' -l ${long}${valuePart}`;
|
|
4366
4383
|
})).join("\n");
|
|
4367
4384
|
const shellCmds = specs.filter((s) => s.positionalValues.length > 0);
|
|
4368
4385
|
return `# forgemap fish completion — drop into your ~/.config/fish/config.fish:
|
|
@@ -4377,7 +4394,7 @@ ${flagLines}
|
|
|
4377
4394
|
# Shell flavor for completion / shell-init (depth 2).
|
|
4378
4395
|
function __forgemap_needs_shell
|
|
4379
4396
|
set -l tokens (commandline -opc)
|
|
4380
|
-
set -l shell_cmds ${shellCmds.map((
|
|
4397
|
+
set -l shell_cmds ${shellCmds.flatMap(namesOf).map((name) => `"${name}"`).join(" ")}
|
|
4381
4398
|
if test (count $tokens) -ge 2; and contains $tokens[2] $shell_cmds
|
|
4382
4399
|
return 0
|
|
4383
4400
|
end
|
|
@@ -4388,7 +4405,7 @@ complete -c forgemap -f -n '__forgemap_needs_shell' -a '${shellCmds[0]?.position
|
|
|
4388
4405
|
# Slugs (depth 2) for commands that take one.
|
|
4389
4406
|
function __forgemap_needs_slug
|
|
4390
4407
|
set -l tokens (commandline -opc)
|
|
4391
|
-
set -l slug_cmds ${specs.filter((s) => s.slugs).map((
|
|
4408
|
+
set -l slug_cmds ${specs.filter((s) => s.slugs).flatMap(namesOf).map((name) => `"${name}"`).join(" ")}
|
|
4392
4409
|
if test (count $tokens) -ge 2; and contains $tokens[2] $slug_cmds
|
|
4393
4410
|
return 0
|
|
4394
4411
|
end
|
|
@@ -4443,7 +4460,7 @@ var completionCommand = defineCommand({
|
|
|
4443
4460
|
runMain(defineCommand({
|
|
4444
4461
|
meta: {
|
|
4445
4462
|
name: "forgemap",
|
|
4446
|
-
version: "0.7.0-dev.
|
|
4463
|
+
version: "0.7.0-dev.129-714bb16",
|
|
4447
4464
|
description: "Manage a local repo layout of the form <root>/<forge.dir>/<owner>/<repo>"
|
|
4448
4465
|
},
|
|
4449
4466
|
subCommands: {
|