Hi everyone,
I want to implement a functionality in fish which allows me to call
scripts inside a folder with a format like so:
```folder/script```

What I've done for now is to define a custom `fish_command_not_found`
function:

```fish
function fish_command_not_found
  if test -e ~/bin/$argv[1]
    ~/bin/$argv[1]
  else
    echo "command not found :("
  end
end
```

This is so that I can call a script `~/bin/myfolder/myscript` with just
`myfolder/myscript`.

That works but I have two issues:
1. The status code is non-zero and I don't seem to be able to override
that (this is a minor issue but prevents the command being added to the
history, I think...)
2. Having a custom completion for this scripts inside folders

This second issue, would be smth like overriding the path completion in fish so 
that
if I type:
`myfolder/<TAB>` I would get completion results: `myscript myother script`

for now I have this function
```
function __provideCompletion
  if test -e ~/bin/$argv[1]
    string split -r -m1 -f2 "/" $(__fish_complete_path ~/bin/"$argv[1]"/)
  end
end
```

But I don't know how to actually hook it up to the path completion on
fish.
Probably there's a better way of doing this (is there prior art?), or
maybe there's not a way of doing what I want...



Attachment: signature.asc
Description: PGP signature

_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to