You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//-- mycli.jsconstargs=require("args");args.option("port","The port on which the app will be running.",4040);args.command("run","Run dev version on localhost.",()=>{console.log("Running on port: "+flags.port);//-- this doesn't work because you cannot access 'flags' before initialization},["r"]);constflags=args.parse(process.argv);
So you can use it like: mycli run --port 3333 and then output: Running on port: 3333. In case you are not using a --port flag, the output should be: Running on port: 4040.
I did not find anything similar in the documentation..
The text was updated successfully, but these errors were encountered:
You may have already figured out the solution, but it passes a copy of flags to the function. It is defined in the "init" function documentation, but I agree it doesn't tie it together into a coherent example.
constargs=require("args");args.option("port","The port on which the app will be running.",4040);args.command("run","Run dev version on localhost.",(name,sub,options)=>{console.log("Running on port: "+options.port);},["r"]);args.parse(process.argv);
Hi, Is it possible to create something like this:
So you can use it like:
mycli run --port 3333
and then output:Running on port: 3333
. In case you are not using a--port
flag, the output should be:Running on port: 4040
.I did not find anything similar in the documentation..
The text was updated successfully, but these errors were encountered: