Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have argv option in fish shell function?

I need to have my fish function accept option for an argv. Something like,

myProg <command> <options>

Currently i have the following function

function myProg
        java -jar "/Users/username/myProg/myprog-0.2.jar" "$argv"
 end

I need to send the following command from my terminal

myProg vm start

Can you please help with how to rewrite the function to accept the options?

Thanks..

like image 482
rr87 Avatar asked Aug 03 '26 05:08

rr87


1 Answers

In fish variables like $argv are arrays and when interpolated into a command should not be enclosed in double-quotes unless you want to concatenate the values into a single string. In other words just define your function like this:

function myProg
    java -jar "/Users/username/myProg/myprog-0.2.jar" $argv
end
like image 197
Kurtis Rader Avatar answered Aug 05 '26 09:08

Kurtis Rader