@getmonoceros/workbench 1.9.1 → 1.9.2

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/bin.js CHANGED
@@ -4428,7 +4428,7 @@ async function persistPromptedIdentity(prompted, ymlPath, home, logger) {
4428
4428
  }
4429
4429
 
4430
4430
  // src/version.ts
4431
- var CLI_VERSION = true ? "1.9.1" : "dev";
4431
+ var CLI_VERSION = true ? "1.9.2" : "dev";
4432
4432
 
4433
4433
  // src/commands/_dispatch.ts
4434
4434
  import { consola as consola12 } from "consola";
@@ -4487,6 +4487,13 @@ function renderCompletionScript(shell) {
4487
4487
  ' candidates=$(monoceros __complete --line "$COMP_LINE" --point "$COMP_POINT" 2>/dev/null)',
4488
4488
  ' local cur="${COMP_WORDS[COMP_CWORD]}"',
4489
4489
  ' COMPREPLY=( $(compgen -W "$candidates" -- "$cur") )',
4490
+ " # Suppress the trailing space when bash narrowed the candidate",
4491
+ " # set to a single token that ends with `=` \u2014 those are value-",
4492
+ " # flags (`--with=`, `--with-ports=`, \u2026) where the user types the",
4493
+ " # value immediately after.",
4494
+ ' if [[ ${#COMPREPLY[@]} -eq 1 && "${COMPREPLY[0]}" == *= ]]; then',
4495
+ " compopt -o nospace",
4496
+ " fi",
4490
4497
  "}",
4491
4498
  "complete -F _monoceros monoceros",
4492
4499
  ""
@@ -4529,10 +4536,22 @@ function renderCompletionScript(shell) {
4529
4536
  "_monoceros() {",
4530
4537
  ' local line="$BUFFER"',
4531
4538
  ' local point="$CURSOR"',
4532
- " local -a candidates",
4539
+ " local -a candidates with_eq without_eq",
4533
4540
  ' candidates=("${(@f)$(monoceros __complete --line "$line" --point "$point" 2>/dev/null)}")',
4534
4541
  ' candidates=("${(@)candidates:#}")',
4535
- " _describe 'completion' candidates",
4542
+ ' # Split candidates into "ends with `=`" (value-flags \u2014 no suffix',
4543
+ " # space wanted because the user types the value immediately) and",
4544
+ ' # "everything else" (positional values, boolean flags \u2014 default',
4545
+ " # space behaviour).",
4546
+ ' for cand in "${candidates[@]}"; do',
4547
+ ' if [[ "$cand" == *= ]]; then',
4548
+ ' with_eq+=("$cand")',
4549
+ " else",
4550
+ ' without_eq+=("$cand")',
4551
+ " fi",
4552
+ " done",
4553
+ " (( ${#with_eq[@]} )) && compadd -S '' -- \"${with_eq[@]}\"",
4554
+ ' (( ${#without_eq[@]} )) && compadd -- "${without_eq[@]}"',
4536
4555
  "}",
4537
4556
  "",
4538
4557
  '_monoceros "$@"',
@@ -4751,7 +4770,7 @@ async function resolvePreDash(spec, preDash, ctx) {
4751
4770
  function listFlagNames(flags, fragment) {
4752
4771
  const names = [];
4753
4772
  for (const [name, spec] of Object.entries(flags)) {
4754
- names.push(name);
4773
+ names.push(spec.type === "value" ? `${name}=` : name);
4755
4774
  for (const alias of spec.aliases ?? []) names.push(alias);
4756
4775
  }
4757
4776
  return filterPrefix(names, fragment);