Nuzair46 / BlockTheSpot-Mac

Spotify Ad blocker for MacOS
GNU General Public License v3.0
1.41k stars 86 forks source link

Handling script arguments when running directly from curl... #10

Closed jetfir3 closed 2 years ago

jetfir3 commented 2 years ago

With the introduction of script arguments, we now need a way to pass the arguments when running the script directly from curl.

Currently "-c" is the only flag/argument supported.. so 2 methods to call this would be: curl -sL https://raw.githubusercontent.com/SpotX-CLI/SpotX-Mac/main/install.sh | bash -s -- -c and curl -sL https://raw.githubusercontent.com/SpotX-CLI/SpotX-Mac/main/install.sh | bash -s /dev/stdin -c

Is -s -- or -s /dev/stdin preferred? Or does someone have a suggestion which is not listed above?

Nuzair46 commented 2 years ago

I think we can just use curl -s https://raw.githubusercontent.com/SpotX-CLI/SpotX-Mac/main/install.sh | bash -s -c

jetfir3 commented 2 years ago

I think we can just use curl -s https://raw.githubusercontent.com/SpotX-CLI/SpotX-Mac/main/install.sh | bash -s -c

That command runs without error for you? For myself I get the following: curl -sL https://raw.githubusercontent.com/SpotX-CLI/SpotX-Mac/main/install.sh | bash -s -c bash: -c: option requires an argument (23) Failed writing body

But I did just try -s - instead of -s -- and that also succeeds and may be the shortest route to handling arguments.

From the bash man page:

A -- signals the end of options and disables further option processing. Any arguments after the -- are treated as filenames and arguments. An argument of - is equivalent to --.

Nuzair46 commented 2 years ago

ok. We can actually use anyone of the commands you mentioned first. Open a pr for it updating the readme. Ill merge.

jetfir3 commented 2 years ago

pr made.