@optique/core 1.0.0-dev.1227 → 1.0.0-dev.1228
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/facade.cjs +18 -4
- package/dist/facade.js +18 -4
- package/package.json +1 -1
package/dist/facade.cjs
CHANGED
|
@@ -678,7 +678,11 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
|
|
|
678
678
|
sectionOrder
|
|
679
679
|
}));
|
|
680
680
|
}
|
|
681
|
-
return require_mode_dispatch.dispatchByMode(parser.$mode, () =>
|
|
681
|
+
return require_mode_dispatch.dispatchByMode(parser.$mode, () => {
|
|
682
|
+
const result = callOnError(1);
|
|
683
|
+
if (result instanceof Promise) throw new RunParserError("Synchronous parser returned async result.");
|
|
684
|
+
return result;
|
|
685
|
+
}, async () => callOnError(1));
|
|
682
686
|
}
|
|
683
687
|
const shell = availableShells[shellName];
|
|
684
688
|
if (!shell) {
|
|
@@ -691,19 +695,29 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
|
|
|
691
695
|
colors,
|
|
692
696
|
quotes: !colors
|
|
693
697
|
}));
|
|
694
|
-
return require_mode_dispatch.dispatchByMode(parser.$mode, () =>
|
|
698
|
+
return require_mode_dispatch.dispatchByMode(parser.$mode, () => {
|
|
699
|
+
const result = callOnError(1);
|
|
700
|
+
if (result instanceof Promise) throw new RunParserError("Synchronous parser returned async result.");
|
|
701
|
+
return result;
|
|
702
|
+
}, async () => callOnError(1));
|
|
695
703
|
}
|
|
696
704
|
if (args.length === 0) {
|
|
697
705
|
const completionArg = isOptionMode ? completionOptionDisplayName ?? "--completion" : completionCommandDisplayName ?? "completion";
|
|
698
706
|
const script = shell.generateScript(programName, [completionArg, shellName]);
|
|
699
707
|
stdout(script);
|
|
700
|
-
return require_mode_dispatch.dispatchByMode(parser.$mode, () =>
|
|
708
|
+
return require_mode_dispatch.dispatchByMode(parser.$mode, () => {
|
|
709
|
+
const result = callOnCompletion(0);
|
|
710
|
+
if (result instanceof Promise) throw new RunParserError("Synchronous parser returned async result.");
|
|
711
|
+
return result;
|
|
712
|
+
}, async () => callOnCompletion(0));
|
|
701
713
|
}
|
|
702
714
|
return require_mode_dispatch.dispatchByMode(parser.$mode, () => {
|
|
703
715
|
const syncParser = parser;
|
|
704
716
|
const suggestions = require_parser.suggest(syncParser, args);
|
|
705
717
|
for (const chunk of shell.encodeSuggestions(suggestions)) stdout(chunk);
|
|
706
|
-
|
|
718
|
+
const result = callOnCompletion(0);
|
|
719
|
+
if (result instanceof Promise) throw new RunParserError("Synchronous parser returned async result.");
|
|
720
|
+
return result;
|
|
707
721
|
}, async () => {
|
|
708
722
|
const suggestions = await require_parser.suggestAsync(parser, args);
|
|
709
723
|
for (const chunk of shell.encodeSuggestions(suggestions)) stdout(chunk);
|
package/dist/facade.js
CHANGED
|
@@ -678,7 +678,11 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
|
|
|
678
678
|
sectionOrder
|
|
679
679
|
}));
|
|
680
680
|
}
|
|
681
|
-
return dispatchByMode(parser.$mode, () =>
|
|
681
|
+
return dispatchByMode(parser.$mode, () => {
|
|
682
|
+
const result = callOnError(1);
|
|
683
|
+
if (result instanceof Promise) throw new RunParserError("Synchronous parser returned async result.");
|
|
684
|
+
return result;
|
|
685
|
+
}, async () => callOnError(1));
|
|
682
686
|
}
|
|
683
687
|
const shell = availableShells[shellName];
|
|
684
688
|
if (!shell) {
|
|
@@ -691,19 +695,29 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
|
|
|
691
695
|
colors,
|
|
692
696
|
quotes: !colors
|
|
693
697
|
}));
|
|
694
|
-
return dispatchByMode(parser.$mode, () =>
|
|
698
|
+
return dispatchByMode(parser.$mode, () => {
|
|
699
|
+
const result = callOnError(1);
|
|
700
|
+
if (result instanceof Promise) throw new RunParserError("Synchronous parser returned async result.");
|
|
701
|
+
return result;
|
|
702
|
+
}, async () => callOnError(1));
|
|
695
703
|
}
|
|
696
704
|
if (args.length === 0) {
|
|
697
705
|
const completionArg = isOptionMode ? completionOptionDisplayName ?? "--completion" : completionCommandDisplayName ?? "completion";
|
|
698
706
|
const script = shell.generateScript(programName, [completionArg, shellName]);
|
|
699
707
|
stdout(script);
|
|
700
|
-
return dispatchByMode(parser.$mode, () =>
|
|
708
|
+
return dispatchByMode(parser.$mode, () => {
|
|
709
|
+
const result = callOnCompletion(0);
|
|
710
|
+
if (result instanceof Promise) throw new RunParserError("Synchronous parser returned async result.");
|
|
711
|
+
return result;
|
|
712
|
+
}, async () => callOnCompletion(0));
|
|
701
713
|
}
|
|
702
714
|
return dispatchByMode(parser.$mode, () => {
|
|
703
715
|
const syncParser = parser;
|
|
704
716
|
const suggestions = suggest(syncParser, args);
|
|
705
717
|
for (const chunk of shell.encodeSuggestions(suggestions)) stdout(chunk);
|
|
706
|
-
|
|
718
|
+
const result = callOnCompletion(0);
|
|
719
|
+
if (result instanceof Promise) throw new RunParserError("Synchronous parser returned async result.");
|
|
720
|
+
return result;
|
|
707
721
|
}, async () => {
|
|
708
722
|
const suggestions = await suggestAsync(parser, args);
|
|
709
723
|
for (const chunk of shell.encodeSuggestions(suggestions)) stdout(chunk);
|