The idea would be to be able to write something like this:
function yt --pure
youtube-dl $argv
end
The parser should stop interpreting arguments after the yt function call and pass the args as strings to the function as before.Then such a call would be possible: yt https://www.youtube.com/watch?v=mqma6GpM7vM
# Second Topic
I wrote a little utility [1] to quicker navigate on the file system. Right now I have two commands:
m [folder] // goto highest ranked folder
mm [folder] // list results for folder-keyword
I would like to be able to write 'm foobar' and then press tab to get a vertical completion-list. When the user selects a completion-list-item I would like to pass the result-path to the cd command.
Some time ago I tried to write such a completion, but failed – that's why I still use a separate mm-function to list search results.[1]: https://github.com/thibran/maybe
I think JSON might be a good choice here because it would simplify the interaction with the completion program for advanced completions. Passing all those flags – mixed with some other shell function calls – to the 'complete' program is a bit cumbersome. My dream would be to have something like 'complete -c maybe --json [maybe-flag-to-generate-json-output]' and handle everything inside the application.
{
"fish_completion_version": 1,
"header": "optional, completion header",
"orientation": "vertical",
"on_single_result": "optional, choose-item or display-item",
"arguments": [
{
"item",
"description",
"optional return value, if empty return item"
}],
"item_handler": "optional, name of fish function to call on-item-chosen"
}
I know JSON is not something you want to assemble in a script, but all programming languages have support for it and it's easy to use.