@optique/core 1.0.0-dev.1970 → 1.0.0-dev.1974

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.
@@ -308,7 +308,7 @@ const zsh = {
308
308
  generateScript(programName, args = []) {
309
309
  validateProgramName(programName);
310
310
  const escapedArgs = args.map((arg) => `'${arg.replace(/'/g, "'\\''")}'`).join(" ");
311
- return `
311
+ return `#compdef ${programName}
312
312
  function _${programName.replace(/[^a-zA-Z0-9]/g, "_")} () {
313
313
  local current="\$words[CURRENT]"
314
314
  local -a prev
@@ -348,6 +348,12 @@ function _${programName.replace(/[^a-zA-Z0-9]/g, "_")} () {
348
348
  pattern="\${pattern//%3A/:}"; pattern="\${pattern//%25/%}"
349
349
  has_file_completion=1
350
350
 
351
+ # Native completion helpers expect normal zsh glob grouping even if
352
+ # the caller enabled SH_GLOB in their shell options.
353
+ local __was_sh_glob=0
354
+ [[ -o sh_glob ]] && __was_sh_glob=1
355
+ unsetopt sh_glob
356
+
351
357
  # Enable glob_dots when hidden files are requested so that
352
358
  # _files and _directories include dot-prefixed entries
353
359
  local __was_glob_dots=0
@@ -403,6 +409,7 @@ function _${programName.replace(/[^a-zA-Z0-9]/g, "_")} () {
403
409
 
404
410
  # Restore PREFIX and glob_dots to their previous state
405
411
  PREFIX="\$__saved_prefix"
412
+ if [[ "\$__was_sh_glob" == "1" ]]; then setopt sh_glob; else unsetopt sh_glob; fi
406
413
  if [[ "\$__was_glob_dots" == "1" ]]; then setopt glob_dots; else unsetopt glob_dots; fi
407
414
  else
408
415
  # Regular literal completion
@@ -308,7 +308,7 @@ const zsh = {
308
308
  generateScript(programName, args = []) {
309
309
  validateProgramName(programName);
310
310
  const escapedArgs = args.map((arg) => `'${arg.replace(/'/g, "'\\''")}'`).join(" ");
311
- return `
311
+ return `#compdef ${programName}
312
312
  function _${programName.replace(/[^a-zA-Z0-9]/g, "_")} () {
313
313
  local current="\$words[CURRENT]"
314
314
  local -a prev
@@ -348,6 +348,12 @@ function _${programName.replace(/[^a-zA-Z0-9]/g, "_")} () {
348
348
  pattern="\${pattern//%3A/:}"; pattern="\${pattern//%25/%}"
349
349
  has_file_completion=1
350
350
 
351
+ # Native completion helpers expect normal zsh glob grouping even if
352
+ # the caller enabled SH_GLOB in their shell options.
353
+ local __was_sh_glob=0
354
+ [[ -o sh_glob ]] && __was_sh_glob=1
355
+ unsetopt sh_glob
356
+
351
357
  # Enable glob_dots when hidden files are requested so that
352
358
  # _files and _directories include dot-prefixed entries
353
359
  local __was_glob_dots=0
@@ -403,6 +409,7 @@ function _${programName.replace(/[^a-zA-Z0-9]/g, "_")} () {
403
409
 
404
410
  # Restore PREFIX and glob_dots to their previous state
405
411
  PREFIX="\$__saved_prefix"
412
+ if [[ "\$__was_sh_glob" == "1" ]]; then setopt sh_glob; else unsetopt sh_glob; fi
406
413
  if [[ "\$__was_glob_dots" == "1" ]]; then setopt glob_dots; else unsetopt glob_dots; fi
407
414
  else
408
415
  # Regular literal completion
@@ -473,7 +473,7 @@ function option(...args) {
473
473
  if (context.buffer.length < 2) return {
474
474
  success: false,
475
475
  consumed: 1,
476
- error: require_message.message`Option ${require_message.optionName(context.buffer[0])} requires a value, but got no value.`
476
+ error: options.errors?.endOfInput ?? require_message.message`${require_message.optionName(context.buffer[0])} requires ${require_message.metavar(valueParser.metavar)}.`
477
477
  };
478
478
  const rawInput = context.buffer[1];
479
479
  return require_mode_dispatch.dispatchByMode(mode, () => {
@@ -473,7 +473,7 @@ function option(...args) {
473
473
  if (context.buffer.length < 2) return {
474
474
  success: false,
475
475
  consumed: 1,
476
- error: message`Option ${optionName(context.buffer[0])} requires a value, but got no value.`
476
+ error: options.errors?.endOfInput ?? message`${optionName(context.buffer[0])} requires ${metavar(valueParser.metavar)}.`
477
477
  };
478
478
  const rawInput = context.buffer[1];
479
479
  return dispatchByMode(mode, () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.0.0-dev.1970+0182ae32",
3
+ "version": "1.0.0-dev.1974+3f35acc7",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",