DEV Community

Discussion on: Creating a command-line app in Node.js: Argument Parsing

Collapse
 
elaspog profile image
László Pogány • Edited

Hi Kumar,

I'm sorry to tell you, but your tutorial is not a quality work...

  • the description you have written it's simply not enough to a nodejs beginner to recreate the same application you wrote

  • does not precisely determines where to put this new code if someone would like to continue your previous example

  • simply doesn't work if I don't change the 'command' string to 'commander' in the next lines:

instead of:
if (command.name) console.log(Your name is ${command.name}.)
if (command.demo) console.log(This is a DEMO.)

this is correct:
if (commander.name) console.log(Your name is ${commander.name}.)
if (commander.demo) console.log(This is a DEMO.)

  • even if I change, I get a strange behavior when I try to run the demo option:

$ node index.js demo
Your name is function(str) {
if (arguments.length === 0) return this._name;
this._name = str;
return this;
}.
This is a DEMO.

  • the '-v' option is not recognized by this library, the capital '-V' is the good one:

$ node index.js -v
error: unknown option '-v'

$ node index.js -V
v0.0.1

  • there is no git repository behind your code, where people could check your working solution if they don't succeed

Please be more precise when you are publishing any tutorial in the future, because you can cause a lot of headache to the beginners.

Collapse
 
kumareth profile image
Kumar Abhirup • Edited

Hey! Thank you so much! This means so much to me!

I will be taking care that I don't make over-assumptions about what people know and don't know.

Thank you again!

Also, if possible, can you please give me this critical feedback on my other posts as well? This will help me improve!

Will update the article this weekend.

Collapse
 
elaspog profile image
László Pogány

I can write feedback later of course, but my most important suggestions in every case would be:

  • Everything need to be reproducible and verifiable by others

    • This is why the professionals use git where they put their code/configuration/settings etc. and attach the URL for the example before/after the article
  • If you write tutorials for beginners (I can assume this by the topic choice), everything should be written in step-by-step manner (where to put exactly what, what to uncommet, or where to cut from, what are the main steps, main stages and snapshots of the code for a given step/functionality etc.)

  • What are the requirements/environment/dependencies (that's OK in your case because npm makes this easy), how to install or set them. The dependencies/URLs might break by time, they always should be checked whether they are still valid.

Thread Thread
 
kumareth profile image
Kumar Abhirup

Thanks, will look forward to implementing these from next tutorials I create! Will also update the last ones.