@optique/core 0.10.6 → 0.10.7-dev.485

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.
@@ -506,7 +506,6 @@ function multiple(parser, options = {}) {
506
506
  });
507
507
  },
508
508
  suggest(context, prefix) {
509
- const innerState = context.state.length > 0 ? context.state.at(-1) : parser.initialState;
510
509
  const selectedValues = /* @__PURE__ */ new Set();
511
510
  for (const s of context.state) {
512
511
  const completed = syncParser.complete(s);
@@ -522,12 +521,12 @@ function multiple(parser, options = {}) {
522
521
  return require_mode_dispatch.dispatchIterableByMode(parser.$mode, function* () {
523
522
  for (const s of syncParser.suggest({
524
523
  ...context,
525
- state: innerState
524
+ state: parser.initialState
526
525
  }, prefix)) if (shouldInclude(s)) yield s;
527
526
  }, async function* () {
528
527
  const suggestions = parser.suggest({
529
528
  ...context,
530
- state: innerState
529
+ state: parser.initialState
531
530
  }, prefix);
532
531
  for await (const s of suggestions) if (shouldInclude(s)) yield s;
533
532
  });
package/dist/modifiers.js CHANGED
@@ -506,7 +506,6 @@ function multiple(parser, options = {}) {
506
506
  });
507
507
  },
508
508
  suggest(context, prefix) {
509
- const innerState = context.state.length > 0 ? context.state.at(-1) : parser.initialState;
510
509
  const selectedValues = /* @__PURE__ */ new Set();
511
510
  for (const s of context.state) {
512
511
  const completed = syncParser.complete(s);
@@ -522,12 +521,12 @@ function multiple(parser, options = {}) {
522
521
  return dispatchIterableByMode(parser.$mode, function* () {
523
522
  for (const s of syncParser.suggest({
524
523
  ...context,
525
- state: innerState
524
+ state: parser.initialState
526
525
  }, prefix)) if (shouldInclude(s)) yield s;
527
526
  }, async function* () {
528
527
  const suggestions = parser.suggest({
529
528
  ...context,
530
- state: innerState
529
+ state: parser.initialState
531
530
  }, prefix);
532
531
  for await (const s of suggestions) if (shouldInclude(s)) yield s;
533
532
  });
@@ -1,5 +1,6 @@
1
1
  const require_message = require('./message.cjs');
2
2
  const require_dependency = require('./dependency.cjs');
3
+ const require_mode_dispatch = require('./mode-dispatch.cjs');
3
4
  const require_usage = require('./usage.cjs');
4
5
  const require_suggestion = require('./suggestion.cjs');
5
6
  const require_usage_internals = require('./usage-internals.cjs');
@@ -785,6 +786,7 @@ function argument(valueParser, options = {}) {
785
786
  };
786
787
  },
787
788
  suggest(context, prefix) {
789
+ if (context.state != null) return require_mode_dispatch.dispatchIterableByMode(valueParser.$mode, function* () {}, async function* () {});
788
790
  if (isAsync) return suggestArgumentAsync(valueParser, options.hidden ?? false, prefix, context.dependencyRegistry);
789
791
  return suggestArgumentSync(valueParser, options.hidden ?? false, prefix, context.dependencyRegistry);
790
792
  },
@@ -1,5 +1,6 @@
1
1
  import { message, metavar, optionName, optionNames, text, valueSet } from "./message.js";
2
2
  import { createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, dependencyId, getDefaultValuesFunction, getDependencyIds, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isPendingDependencySourceState, suggestWithDependency } from "./dependency.js";
3
+ import { dispatchIterableByMode } from "./mode-dispatch.js";
3
4
  import { extractOptionNames } from "./usage.js";
4
5
  import { DEFAULT_FIND_SIMILAR_OPTIONS, createErrorWithSuggestions, createSuggestionMessage, findSimilar } from "./suggestion.js";
5
6
  import { extractLeadingCommandNames } from "./usage-internals.js";
@@ -785,6 +786,7 @@ function argument(valueParser, options = {}) {
785
786
  };
786
787
  },
787
788
  suggest(context, prefix) {
789
+ if (context.state != null) return dispatchIterableByMode(valueParser.$mode, function* () {}, async function* () {});
788
790
  if (isAsync) return suggestArgumentAsync(valueParser, options.hidden ?? false, prefix, context.dependencyRegistry);
789
791
  return suggestArgumentSync(valueParser, options.hidden ?? false, prefix, context.dependencyRegistry);
790
792
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "0.10.6",
3
+ "version": "0.10.7-dev.485+0a30b635",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",