简体   繁体   中英

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

I created a function named pushall that runs

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?

You could do

function pushall
    git add .

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

    git push
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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