@optique/core 1.0.0-dev.1172 → 1.0.0-dev.1178
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/completion.cjs +9 -12
- package/dist/completion.js +9 -12
- package/dist/valueparser.cjs +1 -1
- package/dist/valueparser.js +1 -1
- package/package.json +1 -1
package/dist/completion.cjs
CHANGED
|
@@ -72,6 +72,7 @@ function _${programName} () {
|
|
|
72
72
|
if [[ "$line" == __FILE__:* ]]; then
|
|
73
73
|
# Parse file completion directive: __FILE__:type:extensions:pattern:hidden
|
|
74
74
|
IFS=':' read -r _ type extensions pattern hidden <<< "$line"
|
|
75
|
+
extensions="\${extensions//,\\./,}"; extensions="\${extensions#.}"
|
|
75
76
|
pattern="\${pattern//%3A/:}"; pattern="\${pattern//%25/%}"
|
|
76
77
|
|
|
77
78
|
# Save and adjust glob/shell options for safe file completion
|
|
@@ -655,7 +656,7 @@ ${escapedArgs ? ` set -l output (${programName} ${escapedArgs} $prev $current
|
|
|
655
656
|
# Filter by extensions if specified
|
|
656
657
|
if test -n "$extensions" -a "$type" != directory
|
|
657
658
|
set -l filtered
|
|
658
|
-
set -l ext_list (string split ',' -- $extensions)
|
|
659
|
+
set -l ext_list (string replace -r '^\\.' '' -- (string split ',' -- $extensions))
|
|
659
660
|
for item in $items
|
|
660
661
|
# Skip directories, they don't have extensions
|
|
661
662
|
if string match -q '*/' -- $item
|
|
@@ -919,7 +920,7 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
919
920
|
if ($extensions | is-empty) {
|
|
920
921
|
(if $hidden { ls -a $ls_pattern } else { ls $ls_pattern }) | where type == file or type == dir
|
|
921
922
|
} else {
|
|
922
|
-
let ext_list = ($extensions | split row ',')
|
|
923
|
+
let ext_list = ($extensions | split row ',' | each {|e| $e | str replace -r '^\\.' '' })
|
|
923
924
|
let all_items = (if $hidden { ls -a $ls_pattern } else { ls $ls_pattern })
|
|
924
925
|
let dirs = $all_items | where type == dir
|
|
925
926
|
let files = $all_items | where type == file | where {|f|
|
|
@@ -936,7 +937,7 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
936
937
|
if ($extensions | is-empty) {
|
|
937
938
|
if $hidden { ls -a $ls_pattern } else { ls $ls_pattern }
|
|
938
939
|
} else {
|
|
939
|
-
let ext_list = ($extensions | split row ',')
|
|
940
|
+
let ext_list = ($extensions | split row ',' | each {|e| $e | str replace -r '^\\.' '' })
|
|
940
941
|
let all_items = (if $hidden { ls -a $ls_pattern } else { ls $ls_pattern })
|
|
941
942
|
let dirs = $all_items | where type == dir
|
|
942
943
|
let files = $all_items | where type == file | where {|f|
|
|
@@ -1154,7 +1155,7 @@ ${escapedArgs ? ` \$completionArgs += @(${escapedArgs})
|
|
|
1154
1155
|
|
|
1155
1156
|
# Use -Force to include hidden files when requested, or when
|
|
1156
1157
|
# the prefix basename targets dotfiles (e.g., src/.e)
|
|
1157
|
-
\$prefixBasename = Split-Path -Leaf \$prefix
|
|
1158
|
+
\$prefixBasename = if (\$prefix) { Split-Path -Leaf \$prefix } else { '' }
|
|
1158
1159
|
\$forceParam = if (\$hidden -or (\$prefixBasename -and \$prefixBasename.StartsWith('.'))) { @{Force = \$true} } else { @{} }
|
|
1159
1160
|
|
|
1160
1161
|
# If prefix is a directory without trailing slash, append
|
|
@@ -1173,12 +1174,10 @@ ${escapedArgs ? ` \$completionArgs += @(${escapedArgs})
|
|
|
1173
1174
|
'file' {
|
|
1174
1175
|
if (\$extensions) {
|
|
1175
1176
|
# Filter by extensions, always include directories
|
|
1176
|
-
\$extList = \$extensions -split ','
|
|
1177
|
+
\$extList = (\$extensions -split ',') -replace '^\\.',''
|
|
1177
1178
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue |
|
|
1178
1179
|
Where-Object {
|
|
1179
|
-
|
|
1180
|
-
\$ext = \$_.Extension
|
|
1181
|
-
\$extList | ForEach-Object { if (\$ext -eq ".\$_") { return \$true } }
|
|
1180
|
+
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -in \$extList)
|
|
1182
1181
|
}
|
|
1183
1182
|
} else {
|
|
1184
1183
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue
|
|
@@ -1190,12 +1189,10 @@ ${escapedArgs ? ` \$completionArgs += @(${escapedArgs})
|
|
|
1190
1189
|
'any' {
|
|
1191
1190
|
if (\$extensions) {
|
|
1192
1191
|
# Filter by extensions, always include directories
|
|
1193
|
-
\$extList = \$extensions -split ','
|
|
1192
|
+
\$extList = (\$extensions -split ',') -replace '^\\.',''
|
|
1194
1193
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue |
|
|
1195
1194
|
Where-Object {
|
|
1196
|
-
|
|
1197
|
-
\$ext = \$_.Extension
|
|
1198
|
-
\$extList | ForEach-Object { if (\$ext -eq ".\$_") { return \$true } }
|
|
1195
|
+
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -in \$extList)
|
|
1199
1196
|
}
|
|
1200
1197
|
} else {
|
|
1201
1198
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue
|
package/dist/completion.js
CHANGED
|
@@ -72,6 +72,7 @@ function _${programName} () {
|
|
|
72
72
|
if [[ "$line" == __FILE__:* ]]; then
|
|
73
73
|
# Parse file completion directive: __FILE__:type:extensions:pattern:hidden
|
|
74
74
|
IFS=':' read -r _ type extensions pattern hidden <<< "$line"
|
|
75
|
+
extensions="\${extensions//,\\./,}"; extensions="\${extensions#.}"
|
|
75
76
|
pattern="\${pattern//%3A/:}"; pattern="\${pattern//%25/%}"
|
|
76
77
|
|
|
77
78
|
# Save and adjust glob/shell options for safe file completion
|
|
@@ -655,7 +656,7 @@ ${escapedArgs ? ` set -l output (${programName} ${escapedArgs} $prev $current
|
|
|
655
656
|
# Filter by extensions if specified
|
|
656
657
|
if test -n "$extensions" -a "$type" != directory
|
|
657
658
|
set -l filtered
|
|
658
|
-
set -l ext_list (string split ',' -- $extensions)
|
|
659
|
+
set -l ext_list (string replace -r '^\\.' '' -- (string split ',' -- $extensions))
|
|
659
660
|
for item in $items
|
|
660
661
|
# Skip directories, they don't have extensions
|
|
661
662
|
if string match -q '*/' -- $item
|
|
@@ -919,7 +920,7 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
919
920
|
if ($extensions | is-empty) {
|
|
920
921
|
(if $hidden { ls -a $ls_pattern } else { ls $ls_pattern }) | where type == file or type == dir
|
|
921
922
|
} else {
|
|
922
|
-
let ext_list = ($extensions | split row ',')
|
|
923
|
+
let ext_list = ($extensions | split row ',' | each {|e| $e | str replace -r '^\\.' '' })
|
|
923
924
|
let all_items = (if $hidden { ls -a $ls_pattern } else { ls $ls_pattern })
|
|
924
925
|
let dirs = $all_items | where type == dir
|
|
925
926
|
let files = $all_items | where type == file | where {|f|
|
|
@@ -936,7 +937,7 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
936
937
|
if ($extensions | is-empty) {
|
|
937
938
|
if $hidden { ls -a $ls_pattern } else { ls $ls_pattern }
|
|
938
939
|
} else {
|
|
939
|
-
let ext_list = ($extensions | split row ',')
|
|
940
|
+
let ext_list = ($extensions | split row ',' | each {|e| $e | str replace -r '^\\.' '' })
|
|
940
941
|
let all_items = (if $hidden { ls -a $ls_pattern } else { ls $ls_pattern })
|
|
941
942
|
let dirs = $all_items | where type == dir
|
|
942
943
|
let files = $all_items | where type == file | where {|f|
|
|
@@ -1154,7 +1155,7 @@ ${escapedArgs ? ` \$completionArgs += @(${escapedArgs})
|
|
|
1154
1155
|
|
|
1155
1156
|
# Use -Force to include hidden files when requested, or when
|
|
1156
1157
|
# the prefix basename targets dotfiles (e.g., src/.e)
|
|
1157
|
-
\$prefixBasename = Split-Path -Leaf \$prefix
|
|
1158
|
+
\$prefixBasename = if (\$prefix) { Split-Path -Leaf \$prefix } else { '' }
|
|
1158
1159
|
\$forceParam = if (\$hidden -or (\$prefixBasename -and \$prefixBasename.StartsWith('.'))) { @{Force = \$true} } else { @{} }
|
|
1159
1160
|
|
|
1160
1161
|
# If prefix is a directory without trailing slash, append
|
|
@@ -1173,12 +1174,10 @@ ${escapedArgs ? ` \$completionArgs += @(${escapedArgs})
|
|
|
1173
1174
|
'file' {
|
|
1174
1175
|
if (\$extensions) {
|
|
1175
1176
|
# Filter by extensions, always include directories
|
|
1176
|
-
\$extList = \$extensions -split ','
|
|
1177
|
+
\$extList = (\$extensions -split ',') -replace '^\\.',''
|
|
1177
1178
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue |
|
|
1178
1179
|
Where-Object {
|
|
1179
|
-
|
|
1180
|
-
\$ext = \$_.Extension
|
|
1181
|
-
\$extList | ForEach-Object { if (\$ext -eq ".\$_") { return \$true } }
|
|
1180
|
+
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -in \$extList)
|
|
1182
1181
|
}
|
|
1183
1182
|
} else {
|
|
1184
1183
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue
|
|
@@ -1190,12 +1189,10 @@ ${escapedArgs ? ` \$completionArgs += @(${escapedArgs})
|
|
|
1190
1189
|
'any' {
|
|
1191
1190
|
if (\$extensions) {
|
|
1192
1191
|
# Filter by extensions, always include directories
|
|
1193
|
-
\$extList = \$extensions -split ','
|
|
1192
|
+
\$extList = (\$extensions -split ',') -replace '^\\.',''
|
|
1194
1193
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue |
|
|
1195
1194
|
Where-Object {
|
|
1196
|
-
|
|
1197
|
-
\$ext = \$_.Extension
|
|
1198
|
-
\$extList | ForEach-Object { if (\$ext -eq ".\$_") { return \$true } }
|
|
1195
|
+
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -in \$extList)
|
|
1199
1196
|
}
|
|
1200
1197
|
} else {
|
|
1201
1198
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue
|
package/dist/valueparser.cjs
CHANGED
|
@@ -1239,7 +1239,7 @@ function hostname(options) {
|
|
|
1239
1239
|
error: msg
|
|
1240
1240
|
};
|
|
1241
1241
|
}
|
|
1242
|
-
if (label === "*") continue;
|
|
1242
|
+
if (label === "*" && allowWildcard && input.startsWith("*.") && label === labels[0]) continue;
|
|
1243
1243
|
if (label.startsWith("-") || label.endsWith("-")) {
|
|
1244
1244
|
const errorMsg = options?.errors?.invalidHostname;
|
|
1245
1245
|
const msg = typeof errorMsg === "function" ? errorMsg(input) : errorMsg ?? require_message.message`Expected a valid hostname, but got ${input}.`;
|
package/dist/valueparser.js
CHANGED
|
@@ -1239,7 +1239,7 @@ function hostname(options) {
|
|
|
1239
1239
|
error: msg
|
|
1240
1240
|
};
|
|
1241
1241
|
}
|
|
1242
|
-
if (label === "*") continue;
|
|
1242
|
+
if (label === "*" && allowWildcard && input.startsWith("*.") && label === labels[0]) continue;
|
|
1243
1243
|
if (label.startsWith("-") || label.endsWith("-")) {
|
|
1244
1244
|
const errorMsg = options?.errors?.invalidHostname;
|
|
1245
1245
|
const msg = typeof errorMsg === "function" ? errorMsg(input) : errorMsg ?? message`Expected a valid hostname, but got ${input}.`;
|