Reputation: 4107
I am developing the Node.js package, which includes a command-line utility. Now alacon.js is located in the root of the package. To run this utility I have to use word node
before the name of utility, like:
node alacon 'SELECT * FROM CSV("mydata.csv") ORDER BY 2'
Could you help me, what should I change in the package to:
1.To run this utility without node
word, like:
alacon 'SELECT * FROM CSV("mydata.csv") ORDER BY 2'
2.To install this package globally and use the utility everywhere on computer:
npm install -g alasql
alacon 'SELECT 2*2'
In other words, how to create utility like Jison, Gulp and other Node.js similar packages with command-line programs.
I already add the #!/usr/bin/env node
line to the top of the file, but unfortunately have no desired effect.
Thank you!
Upvotes: 0
Views: 319
Reputation: 1141
You will need to make the script executable chmod a+x alacon
.
Then you should be able to run ./alacon 'SELECT * FROM CSV("mydata.csv") ORDER BY 2'
If you wish to invoke the script without ./
then you will need to move it (or symlink it) to /usr/bin.
Alternatively - you could create an alias: alias alacon="node alacon"
Upvotes: 1