简体   繁体   English

鱼 Shell – 如何制作 function 在完成 function 之前要求输入

[英]Fish Shell – how to make a function ask for input before COMPLETING the function

I created a function named pushall that runs我创建了一个名为pushall的 function 运行

git add .
git commit -m "$argv"
git push

however when I run I get the following error但是,当我运行时,出现以下错误

Aborting commit due to empty commit message.

how can make the function ask me for input to enter into the commit message so that the function works as intended?如何使 function 要求我输入以输入提交消息,以便 function 按预期工作?

You could do你可以做

function pushall
    git add .

    if test (count $argv) -eq 0
        git commit
    else
        git commit -m "$argv"
    end

    git push
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM