santinic / how2

AI for the Command Line
https://how2terminal.com
MIT License
5.72k stars 156 forks source link

Add a new syntax: how to <question> #22

Closed huytd closed 2 years ago

huytd commented 8 years ago

Add a new syntax:

how to <question>

So, from now we have a truth magic in our terminal, for example:

how to deploy golang app
how to create a pull request

Why? Because... why not? :laughing:

santinic commented 8 years ago

Oh, nice. I don't know if people expect to have an extra "how" binary when they install how2

huytd commented 8 years ago

I don't think there is a binary named how existed already in any OS :D so this should be ok?

zdravkoggeorgiev commented 8 years ago

IMHO only how is too general word :balloon: :smile:

zunc commented 8 years ago

that's nice idea :+1:

danielkop commented 8 years ago

Perhaps the solution should be: Ignore a "to" prefex in the question. treat "how2 to install npm" as "how2 install npm" This would allow users to set up an alias "how" = "how2", while sticking to the original binary name.

danyshaanan commented 8 years ago

:+1: for @danielkop's solution that will not take up another bin, which is not a nice practice.

huytd commented 8 years ago

Well. It's a good and safe idea!

How about this: We still based on @danielkop's solution but instead of ignoring to prefix for all the call, we will check for the first parameter. Only ignore if it is how (user aliased). If the first parameter still matched how2, we just keep it as it is? :D

Sound like an easter egg :D a hidden feature only work if user do something dirty (create an alias)

danielkop commented 8 years ago

// Add support for 'how to' command if (argv['$0'] === 'how') { argv._.splice(0, 1); }

Removes the second word regardless of whether it's "to" or not. So "how npm install" only searches for "install". probably better to make sure argv['$1'].toLowerCase === 'to' before splicing it.