@getmonoceros/workbench 1.39.0 → 1.39.1

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
@@ -9138,7 +9138,7 @@ var CLI_VERSION;
9138
9138
  var init_version = __esm({
9139
9139
  "src/version.ts"() {
9140
9140
  "use strict";
9141
- CLI_VERSION = true ? "1.39.0" : "dev";
9141
+ CLI_VERSION = true ? "1.39.1" : "dev";
9142
9142
  }
9143
9143
  });
9144
9144
 
@@ -10173,14 +10173,18 @@ Register-ArgumentCompleter -Native -CommandName @('monoceros', 'monoceros.cmd',
10173
10173
 
10174
10174
  # Tokens already complete on the line. When the current word is
10175
10175
  # non-empty it is the last command element \u2014 drop it from "prev".
10176
+ # NOTE: each list is wrapped in @(...) around the whole if-expression.
10177
+ # \`$x = if (...) { @(one-element) }\` enumerates the output and collapses
10178
+ # a single-element array back to a scalar, so \`$tokens[0]\` would index
10179
+ # into a string ('apply'[0] -> 'a'). The outer @(...) forces an array.
10176
10180
  $elements = @($commandAst.CommandElements | ForEach-Object { $_.Extent.Text })
10177
10181
  if ($current -ne '' -and $elements.Count -gt 0 -and $elements[-1] -eq $current) {
10178
- $prev = if ($elements.Count -gt 1) { @($elements[0..($elements.Count - 2)]) } else { @() }
10182
+ $prev = @(if ($elements.Count -gt 1) { $elements[0..($elements.Count - 2)] } else { @() })
10179
10183
  } else {
10180
- $prev = $elements
10184
+ $prev = @($elements)
10181
10185
  }
10182
10186
  # Strip the program name (prev[0]).
10183
- $tokens = if ($prev.Count -gt 1) { @($prev[1..($prev.Count - 1)]) } else { @() }
10187
+ $tokens = @(if ($prev.Count -gt 1) { $prev[1..($prev.Count - 1)] } else { @() })
10184
10188
 
10185
10189
  # No subcommand yet \u2192 complete the subcommand list.
10186
10190
  if ($tokens.Count -eq 0) {
@@ -10191,7 +10195,7 @@ Register-ArgumentCompleter -Native -CommandName @('monoceros', 'monoceros.cmd',
10191
10195
  $spec = $model.specs.PSObject.Properties[$command]
10192
10196
  if (-not $spec) { return }
10193
10197
  $spec = $spec.Value
10194
- $argTokens = if ($tokens.Count -gt 1) { @($tokens[1..($tokens.Count - 1)]) } else { @() }
10198
+ $argTokens = @(if ($tokens.Count -gt 1) { $tokens[1..($tokens.Count - 1)] } else { @() })
10195
10199
 
10196
10200
  # Everything after \`--\` is the inner command \u2014 not ours to complete.
10197
10201
  if ($argTokens -contains '--') { return }