File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -296,3 +296,40 @@ $env.config = {
296296 }
297297}
298298```
299+
300+
301+
302+ ### ` command_not_found ` Hook in _ Windows_
303+
304+ The following hook uses the ` ftype ` command, to find program paths in _ Windows_ that might be relevant to the user for ` alias ` -ing.
305+
306+ ``` nu
307+ $env.config = {
308+ ...other config...
309+
310+ hooks: {
311+ ...other hooks...
312+
313+ command_not_found: {
314+ |cmd_name| (
315+ try {
316+ let attrs = (
317+ ftype | find $cmd_name | to text | lines | reduce -f [] { |line, acc|
318+ $line | parse "{type}={path}" | append $acc
319+ } | group-by path | transpose key value | each { |row|
320+ { path: $row.key, types: ($row.value | get type | str join ", ") }
321+ }
322+ )
323+ let len = ($attrs | length)
324+
325+ if $len == 0 {
326+ return null
327+ } else {
328+ return ($attrs | table --collapse)
329+ }
330+ }
331+ )
332+ }
333+ }
334+ }
335+ ```
You can’t perform that action at this time.
0 commit comments