named-parameters - 我可以将命名参数传递给 Fish 脚本吗?

标签 named-parameters fish

我了解到using $argv访问传递给 Fish 脚本(或函数)的参数值。然而,这种方法需要位置参数。是否可以以任意顺序传递命名参数,并根据名称提取它们?

例如,以下两个调用是等效的:

favourite_shell best=fish ideological_war=start

favourite_shell ideological_war=start best=fish

最佳答案

这是 future ,您现在可以使用argparse:https://fishshell.com/docs/current/cmds/argparse.html

argparse 是原始答案 ( https://github.com/fish-shell/fish-shell/issues/478 ) 中提到的 Github 讨论的结果,现已关闭。

关于named-parameters - 我可以将命名参数传递给 Fish 脚本吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24348885/

相关文章:

fish - 让 Fish 在 HOME 以外的目录中启动我

python - 普通参数与关键字参数

c# - 命名参数的评估顺序

PHP:发送选项列表作为参数(替代命名参数/参数包)

linux - 粘贴到终端/fish shell : [200~ and [201~ 时出现奇怪的字符

ruby - Ruby 中具有默认值的可选参数

fish - fish shell 中带有空格的别名

macos - fish shell : fish_config not setting background color

fish - 如何在 Fish 中使用键盘快捷键扩展环境变量?