Hacker News new | ask | show | jobs
by csytan 6478 days ago
Thanks for asking :)

Adding the brackets greatly simplifies things for the implementation of the command dispatcher/suggester. In addition, in some situations it can be difficult tell what part of the command is an input and what isn't.

For example, let's say a user intends to use the command: translate [text] to [language]

They type:

translate hey buddy! i found this neat guide to japanese

There are two ways to interpret this, both of which are valid:

1. The user typed a full command.

Bracketed version:

translate [hey buddy! i found this neat guide] to [japanese]

2. The user isn't finished writing the text to be translated, and should get a list of suggestions.

Bracketed version:

translate [hey buddy! i found this neat guide to japanese]

I made this app because traditional command lines are often tricky to use. I don't enjoy looking up documentation for each and every command argument.

With this method, you get suggestions at every step of the way (try typing "films starring [").

2 comments

You could make brackets optional. And change them to quotes:

  translate serendipity to french
  translate "go after" to french
Read the curses library implementation. You might find it useful.
Hi :] What part of it would be useful?