我目前正在从ZSH移到鱼。我的大多数别名等都很容易移植,但是我遇到以下问题的问题:
alias idf.py='unalias idf.py; source $IDF_PATH/export.sh; idf.py'
我知道在鱼类别名中只是句法糖的功能,所以我开始编写以下功能:
function "idf.py"
source $IDF_PATH/export.fish
functions --erase idf.py
idf.py $argv
end
export.fish fish脚本来自 esp-idf ,并开始抱怨需要采购。之后,该功能被正确删除了,但是找不到IDF.PY:
his script should be sourced, not executed:
realpath: /home/robert/Programs/esp-idf/export.fish/..: Not a directory
.
fish: Unknown command: idf.py
fish:
idf.py $argv
^
in function 'idf.py'
您是否知道如何从此功能内部源到全局范围?
I'm currently moving from zsh to fish. Most of my aliases etc are pretty easy to port, but I'm running into problems with the following one:
alias idf.py='unalias idf.py; source $IDF_PATH/export.sh; idf.py'
I know in fish aliases are just syntactic sugar for functions so I started writing the following function:
function "idf.py"
source $IDF_PATH/export.fish
functions --erase idf.py
idf.py $argv
end
the export.fish script is from the esp-idf and starts complaining about needing to be sourced. After that the function gets removed correctly but idf.py can not be found:
his script should be sourced, not executed:
realpath: /home/robert/Programs/esp-idf/export.fish/..: Not a directory
.
fish: Unknown command: idf.py
fish:
idf.py $argv
^
in function 'idf.py'
Do you have any idea how I can source to the global scope from within this function?
发布评论
评论(1)
刚刚进行您链接到的项目的提交历史记录 - 您链接的ESP-IDF脚本是最新版本,但是您收到的错误是来自早期版本此后已修复了该脚本的版本。
该脚本试图通过测试
状态当前命令
来检测是否使用source
命令调用它,但是由于您是从函数idf中调用它的。 py
,是返回的名称,而不是source
。这是一个错误,大约在两年前仅通过删除源检查就解决了。
升级到最新的ESP-IDF版本应处理它。
Just going on the commit history of the project you linked to -- The ESP-IDF script you linked is the latest version, but the error you are receiving was from a bug in an earlier version of the script that has since been fixed.
The script attempts to detect whether it is being called with the
source
command by testingstatus current-command
, but since you are calling it from within the functionidf.py
, that's the name returned, rather thansource
.It was a bug, and it was fixed about two years ago by simply removing the source check.
Upgrading to the latest ESP-IDF release should take care of it.