fish shell 选项卡完成程序简短描述 - howto?
fish shell tab completion program short description - howto?
fish shell 有一个很好的功能,可以显示可能的命令的简短描述,例如:
如何为自己的命令编写这样的描述?具体来说,我想为 python console_scripts.
这样做
10 倍。
您可以将此类描述添加到您的 Fish 函数中,例如 example from VirtualFish's activate
sub-command:
function __vf_activate --description "Activate a virtualenv"
[…]
end
您可以在输入 vf
然后按 Tab 键时看到结果输出:
您可以使用内置的漂亮完成功能来完成此操作。
complete -c mm -s i -f --description 'Interactive mode'
这将输出:
mm -i (Interactive mode)
官方文档如下:https://fishshell.com/docs/current/cmds/complete.html
这是一个很好的指南:
https://medium.com/@fabioantunes/a-guide-for-fish-shell-completions-485ac04ac63c
我刚刚在自己创建插件时经历了这方面的学习过程,因此您也可以在这里看看我是如何为 MakeMeFish 完成的:https://github.com/OakNinja/MakeMeFish/tree/next-release
编辑:
您可以使用完成框架为 any 命令创建完成,无论是否钓鱼。 fish 中有大量内置补全,您可以在 github 上查看。看这里:https://github.com/fish-shell/fish-shell/tree/master/share/completions
fish shell 有一个很好的功能,可以显示可能的命令的简短描述,例如:
如何为自己的命令编写这样的描述?具体来说,我想为 python console_scripts.
这样做10 倍。
您可以将此类描述添加到您的 Fish 函数中,例如 example from VirtualFish's activate
sub-command:
function __vf_activate --description "Activate a virtualenv"
[…]
end
您可以在输入 vf
然后按 Tab 键时看到结果输出:
您可以使用内置的漂亮完成功能来完成此操作。
complete -c mm -s i -f --description 'Interactive mode'
这将输出:
mm -i (Interactive mode)
官方文档如下:https://fishshell.com/docs/current/cmds/complete.html
这是一个很好的指南: https://medium.com/@fabioantunes/a-guide-for-fish-shell-completions-485ac04ac63c
我刚刚在自己创建插件时经历了这方面的学习过程,因此您也可以在这里看看我是如何为 MakeMeFish 完成的:https://github.com/OakNinja/MakeMeFish/tree/next-release
编辑: 您可以使用完成框架为 any 命令创建完成,无论是否钓鱼。 fish 中有大量内置补全,您可以在 github 上查看。看这里:https://github.com/fish-shell/fish-shell/tree/master/share/completions