Develop and Publish a Node.js CLI from Scratch

InstructorShawn Wang

Share this video with your friends

Send Tweet

Before you use any frameworks, you should know the fundamentals of what makes Node CLI's tick. Here we explain everything you need to know to write a complete Node.js CLI from scratch, parse arguments, publish it to NPM for users, and set up yarn symlinks for optimal developer experience.

Isaac Weber
~ 4 years ago

what is your zsh theme??

Hicham Naoufal
~ 2 years ago

I was wondering when i came across this line: args[1].slice("--name=")[1] For me this does not work as expected. Is there some hidden magic i am missing, since as far as i know slice expects an startIndex as number?

If I change the code to:

const nameOption = '--name='; const name = args[1].slice(nameOption.length);

Than everything works as expected. Can please someone confirm or explain?

Zac Jones
~ 2 years ago

I was wondering when i came across this line: args[1].slice("--name=")[1] For me this does not work as expected. Is there some hidden magic i am missing, since as far as i know slice expects an startIndex as number?

If I change the code to:

const nameOption = '--name='; const name = args[1].slice(nameOption.length);

Than everything works as expected. Can please someone confirm or explain?

The instructor uses .split instead of .slice which might be where the confusion is coming from?