Open xtyrrell opened 5 years ago
This whole program (with installation) could be reduced to this bash oneliner:
echo '"$@"' >/usr/local/bin/$ ; chmod +x /usr/local/bin/$
You could do the same with any special character you wanted.
You're absolutely right. This would work in the vast majority of cases. It is definitely kind of crazy to spin up an entire JavaScript virtual machine just to pass on a command to the system, and it does feel pretty gross doing so.
That being said, the number one priority for this project is that it is extremely easy for anyone to use, including across operating systems and shells. What you've given is a great base, and I am probably going to use it to replace the JavaScript with an installation shell script that handles permissions and offers uninstallation across operating systems as easily for users as it is with npm.
Thank you!
Here you go:
#!/bin/sh
exec "$@"
This works with signals and everything.
Add support for undollar to 'eat' different shell prompt characters such as and '%' and '#' (though this may warrant a confirmation prompt because it represents a superuser).