@optique/core 1.0.15-dev.2777 → 1.0.15-dev.2789
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 +29 -11
- package/dist/completion.js +29 -11
- package/package.json +1 -1
package/dist/completion.cjs
CHANGED
|
@@ -1025,8 +1025,10 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
1025
1025
|
|
|
1026
1026
|
# If the glob base is a directory without a trailing slash (e.g., "src"),
|
|
1027
1027
|
# append one so that ls enumerates its contents instead of matching
|
|
1028
|
-
# siblings like "src-old"
|
|
1029
|
-
|
|
1028
|
+
# siblings like "src-old". path expand follows symlinks, so that
|
|
1029
|
+
# a symlink to a directory is treated the same way; --no-symlink first
|
|
1030
|
+
# resolves .. against the logical $env.PWD as ls does
|
|
1031
|
+
let glob_base = if ($glob_base | is-not-empty) and ($glob_base | path expand --no-symlink | path expand | path type) == "dir" and (not ($glob_base | str ends-with "/")) {
|
|
1030
1032
|
$glob_base + "/"
|
|
1031
1033
|
} else {
|
|
1032
1034
|
$glob_base
|
|
@@ -1055,15 +1057,31 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
1055
1057
|
null
|
|
1056
1058
|
}
|
|
1057
1059
|
|
|
1058
|
-
#
|
|
1060
|
+
# List entries matching a pattern, using ls -a to include hidden
|
|
1061
|
+
# files when requested. ls reports every symlink as type "symlink",
|
|
1062
|
+
# so classify each one by its target's type instead (path expand
|
|
1063
|
+
# follows symlinks); broken or looping symlinks stay "symlink".
|
|
1064
|
+
# Join the name to $env.PWD first so that a leading ~ in an entry
|
|
1065
|
+
# name is not expanded to a home directory, and resolve .. against
|
|
1066
|
+
# the logical $env.PWD (--no-symlink) before following the symlink
|
|
1067
|
+
let list_entries = {|pattern|
|
|
1068
|
+
(if $hidden { ls -a $pattern } else { ls $pattern }) | each {|item|
|
|
1069
|
+
if $item.type == symlink {
|
|
1070
|
+
$item | update type ($env.PWD | path join $item.name | path expand --no-symlink | path expand | path type)
|
|
1071
|
+
} else {
|
|
1072
|
+
$item
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1059
1077
|
let items = try {
|
|
1060
1078
|
match $type {
|
|
1061
1079
|
"file" => {
|
|
1062
1080
|
if ($extensions | is-empty) {
|
|
1063
|
-
(
|
|
1081
|
+
(do $list_entries $ls_pattern) | where type == file or type == dir
|
|
1064
1082
|
} else {
|
|
1065
1083
|
let ext_list = ($extensions | split row ',' | each {|e| $e | str replace -r '^\\.' '' })
|
|
1066
|
-
let all_items = (
|
|
1084
|
+
let all_items = (do $list_entries $ls_pattern)
|
|
1067
1085
|
let dirs = $all_items | where type == dir
|
|
1068
1086
|
let files = $all_items | where type == file | where {|f|
|
|
1069
1087
|
let ext = ($f.name | path parse | get extension)
|
|
@@ -1073,14 +1091,14 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
1073
1091
|
}
|
|
1074
1092
|
},
|
|
1075
1093
|
"directory" => {
|
|
1076
|
-
(
|
|
1094
|
+
(do $list_entries $ls_pattern) | where type == dir
|
|
1077
1095
|
},
|
|
1078
1096
|
"any" => {
|
|
1079
1097
|
if ($extensions | is-empty) {
|
|
1080
|
-
|
|
1098
|
+
do $list_entries $ls_pattern
|
|
1081
1099
|
} else {
|
|
1082
1100
|
let ext_list = ($extensions | split row ',' | each {|e| $e | str replace -r '^\\.' '' })
|
|
1083
|
-
let all_items = (
|
|
1101
|
+
let all_items = (do $list_entries $ls_pattern)
|
|
1084
1102
|
let dirs = $all_items | where type == dir
|
|
1085
1103
|
let files = $all_items | where type == file | where {|f|
|
|
1086
1104
|
let ext = ($f.name | path parse | get extension)
|
|
@@ -1099,7 +1117,7 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
1099
1117
|
# even when the glob itself does not match directory names)
|
|
1100
1118
|
let items = if ($glob_dir_pattern != null) and ($type != "directory") {
|
|
1101
1119
|
let extra_dirs = try {
|
|
1102
|
-
(
|
|
1120
|
+
(do $list_entries $glob_dir_pattern) | where type == dir
|
|
1103
1121
|
} catch {
|
|
1104
1122
|
[]
|
|
1105
1123
|
}
|
|
@@ -1319,7 +1337,7 @@ ${escapedArgs ? ` \$completionArgs += @(${escapedArgs})
|
|
|
1319
1337
|
\$extList = (\$extensions -split ',') -replace '^\\.',''
|
|
1320
1338
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue |
|
|
1321
1339
|
Where-Object {
|
|
1322
|
-
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -
|
|
1340
|
+
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -cin \$extList)
|
|
1323
1341
|
}
|
|
1324
1342
|
} else {
|
|
1325
1343
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue
|
|
@@ -1334,7 +1352,7 @@ ${escapedArgs ? ` \$completionArgs += @(${escapedArgs})
|
|
|
1334
1352
|
\$extList = (\$extensions -split ',') -replace '^\\.',''
|
|
1335
1353
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue |
|
|
1336
1354
|
Where-Object {
|
|
1337
|
-
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -
|
|
1355
|
+
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -cin \$extList)
|
|
1338
1356
|
}
|
|
1339
1357
|
} else {
|
|
1340
1358
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue
|
package/dist/completion.js
CHANGED
|
@@ -1025,8 +1025,10 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
1025
1025
|
|
|
1026
1026
|
# If the glob base is a directory without a trailing slash (e.g., "src"),
|
|
1027
1027
|
# append one so that ls enumerates its contents instead of matching
|
|
1028
|
-
# siblings like "src-old"
|
|
1029
|
-
|
|
1028
|
+
# siblings like "src-old". path expand follows symlinks, so that
|
|
1029
|
+
# a symlink to a directory is treated the same way; --no-symlink first
|
|
1030
|
+
# resolves .. against the logical $env.PWD as ls does
|
|
1031
|
+
let glob_base = if ($glob_base | is-not-empty) and ($glob_base | path expand --no-symlink | path expand | path type) == "dir" and (not ($glob_base | str ends-with "/")) {
|
|
1030
1032
|
$glob_base + "/"
|
|
1031
1033
|
} else {
|
|
1032
1034
|
$glob_base
|
|
@@ -1055,15 +1057,31 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
1055
1057
|
null
|
|
1056
1058
|
}
|
|
1057
1059
|
|
|
1058
|
-
#
|
|
1060
|
+
# List entries matching a pattern, using ls -a to include hidden
|
|
1061
|
+
# files when requested. ls reports every symlink as type "symlink",
|
|
1062
|
+
# so classify each one by its target's type instead (path expand
|
|
1063
|
+
# follows symlinks); broken or looping symlinks stay "symlink".
|
|
1064
|
+
# Join the name to $env.PWD first so that a leading ~ in an entry
|
|
1065
|
+
# name is not expanded to a home directory, and resolve .. against
|
|
1066
|
+
# the logical $env.PWD (--no-symlink) before following the symlink
|
|
1067
|
+
let list_entries = {|pattern|
|
|
1068
|
+
(if $hidden { ls -a $pattern } else { ls $pattern }) | each {|item|
|
|
1069
|
+
if $item.type == symlink {
|
|
1070
|
+
$item | update type ($env.PWD | path join $item.name | path expand --no-symlink | path expand | path type)
|
|
1071
|
+
} else {
|
|
1072
|
+
$item
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1059
1077
|
let items = try {
|
|
1060
1078
|
match $type {
|
|
1061
1079
|
"file" => {
|
|
1062
1080
|
if ($extensions | is-empty) {
|
|
1063
|
-
(
|
|
1081
|
+
(do $list_entries $ls_pattern) | where type == file or type == dir
|
|
1064
1082
|
} else {
|
|
1065
1083
|
let ext_list = ($extensions | split row ',' | each {|e| $e | str replace -r '^\\.' '' })
|
|
1066
|
-
let all_items = (
|
|
1084
|
+
let all_items = (do $list_entries $ls_pattern)
|
|
1067
1085
|
let dirs = $all_items | where type == dir
|
|
1068
1086
|
let files = $all_items | where type == file | where {|f|
|
|
1069
1087
|
let ext = ($f.name | path parse | get extension)
|
|
@@ -1073,14 +1091,14 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
1073
1091
|
}
|
|
1074
1092
|
},
|
|
1075
1093
|
"directory" => {
|
|
1076
|
-
(
|
|
1094
|
+
(do $list_entries $ls_pattern) | where type == dir
|
|
1077
1095
|
},
|
|
1078
1096
|
"any" => {
|
|
1079
1097
|
if ($extensions | is-empty) {
|
|
1080
|
-
|
|
1098
|
+
do $list_entries $ls_pattern
|
|
1081
1099
|
} else {
|
|
1082
1100
|
let ext_list = ($extensions | split row ',' | each {|e| $e | str replace -r '^\\.' '' })
|
|
1083
|
-
let all_items = (
|
|
1101
|
+
let all_items = (do $list_entries $ls_pattern)
|
|
1084
1102
|
let dirs = $all_items | where type == dir
|
|
1085
1103
|
let files = $all_items | where type == file | where {|f|
|
|
1086
1104
|
let ext = ($f.name | path parse | get extension)
|
|
@@ -1099,7 +1117,7 @@ ${escapedArgs ? ` ^${programName} ${escapedArgs} ...$final_args | complete |
|
|
|
1099
1117
|
# even when the glob itself does not match directory names)
|
|
1100
1118
|
let items = if ($glob_dir_pattern != null) and ($type != "directory") {
|
|
1101
1119
|
let extra_dirs = try {
|
|
1102
|
-
(
|
|
1120
|
+
(do $list_entries $glob_dir_pattern) | where type == dir
|
|
1103
1121
|
} catch {
|
|
1104
1122
|
[]
|
|
1105
1123
|
}
|
|
@@ -1319,7 +1337,7 @@ ${escapedArgs ? ` \$completionArgs += @(${escapedArgs})
|
|
|
1319
1337
|
\$extList = (\$extensions -split ',') -replace '^\\.',''
|
|
1320
1338
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue |
|
|
1321
1339
|
Where-Object {
|
|
1322
|
-
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -
|
|
1340
|
+
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -cin \$extList)
|
|
1323
1341
|
}
|
|
1324
1342
|
} else {
|
|
1325
1343
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue
|
|
@@ -1334,7 +1352,7 @@ ${escapedArgs ? ` \$completionArgs += @(${escapedArgs})
|
|
|
1334
1352
|
\$extList = (\$extensions -split ',') -replace '^\\.',''
|
|
1335
1353
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue |
|
|
1336
1354
|
Where-Object {
|
|
1337
|
-
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -
|
|
1355
|
+
\$_.PSIsContainer -or ((\$_.Extension -replace '^\\.','' ) -cin \$extList)
|
|
1338
1356
|
}
|
|
1339
1357
|
} else {
|
|
1340
1358
|
\$items = Get-ChildItem @forceParam -Path \$globPath -ErrorAction SilentlyContinue
|