unconed / TermKit

Experimental Terminal platform built on WebKit + node.js. Currently only for Mac and Windows, though the prototype works 90% in any WebKit browser.
http://acko.net/
Other
4.43k stars 236 forks source link

User-friendly command names #50

Open ghost opened 13 years ago

ghost commented 13 years ago

Allright y'all. We're reinventing the command line, and we should do it right - with human-readable and -rememberable command names. Let's add a new goal to the project goals: to finally address Donald Norman's criticism in his classic article "The trouble with UNIX" (http://www.linux.org.uk/~dan/rumor/rumor.shrink). Along this line, I suggested to Steven on Twitter that TermKit could have an optional layer that replaces standard command names (cp, mv, etc) with human-readable versions (copy, rename, and so on); he suggested I compile a list of replacement names.

The aim, I think, is to eliminate the need for manuals (and Googling) in 80% of cases. Obviously, manuals will never become obsolete, but we need to make a system where a casual user can simply type in what they want and get the right result in most cases.

Here are some ideas for command names:

I think most commands should be verbose when in user-facing mode: for example, rename should show the new file(s), wait should have a countdown, etc.

Keep in mind this layer will be optional, so please don't comment pointing out that this would be annoying for experienced users. A nice user experience might be to have TermKit ask whether the user would like traditional or user-friendly commands when first launched, and to have the option be toggle-able in the Preferences thereafter. Per @cafarm below, it would also be nice to have an option that echos the underlying commands being performed, which you could toggle on for debugging and/or learning the old commands.

Two challenges that I'm not sure how best to handle are 1) creating files and directories (perhaps create dir/ for mkdir and create file (without the trailing slash) for touch?) and 2) searching for things: the problem is that grep and find are distinctly different, but both are expressed by the concept of 'search' or 'find'. What's the best way to distinguish between the two?

hach-que commented 13 years ago

I think I agree with the idea, but disagree on a few things :)

I think for the create it would actually probably be best dealt with as an argument toggle (-d for example). As for grep / find I think we should have grep built into find as a "find inside files" modifier (i.e. only show files which contain this text), which would leave us with just find.

ghost commented 13 years ago

Thanks for your comments!

I'm going to try and keep the list at the top of the page up-to-date, incorporating everyone's suggestions and comments.

hach-que commented 13 years ago

I think however, that the user might end up typing create dir and realise that instead it created a new empty file. I'm actually not really sure what use-cases there are for creating an empty file though (you can achieve the same using echo "what you were going to put in there" > file anyway).

As for find, it would probably be something like:

find [--infiles] pattern paths

or something to that effect (I still think that argument toggles are useful especially since we now a UI which we can actually indicate the purpose of a toggle in TermKit itself when it's used). Alternatively we can also provide them via AutoComplete.

cafarm commented 13 years ago

I think its important that after you enter the command with the human readable name, TermKit spit back the real underlying command before executing. This will help unix newbies and experts alike.

ghost commented 13 years ago

That wouldn't make sense. If you want to learn the old ways, you should simply choose the 'traditional' setting on install.

cafarm commented 13 years ago

I don't see why this couldn't be a way of learning so you're not completely lost if you're in front of a terminal without TermKit. Also, it would help you diagnose problems if an abstracted human readable command isn't doing what you expected. You can look up "rm -r" on Google. You can't look up "delete"... especially if it changes the underlying command based on the context of how you use it.

It can be completely transparent to users who aren't interested in it. Perhaps it can construct the real unix command on a separate line in real time as you type your human readable command.

ghost commented 13 years ago

You're right, it'd be real helpful for debugging. It has to be off by default though; echoing alphabet soup at a new user is going to destroy their interest in using TermKit. Have added to top comment.

hach-que commented 13 years ago

One issue with showing the command equivalents is that they're totally irrelevant on a different system (we'll likely end up having Linux, Mac OSX and Windows ports). The command to copy a directory recursively and ignoring errors is different on both Windows and Linux; indeed the former has a lot more options relevant to that specific system (such as how to handle networked files).

In the event that someone suggests "we should just let the person writing the command to specify the equivalents", an issue is raised when the command writer doesn't know the equivalent commands, or more importantly, provides the wrong information.

I think it's probably best to not show equivalent commands in TermKit. Eventually TermKit will do remote connections over SSH, so you won't need to deal with the issue of "I don't have a TermKit in front of me" because of that (the other situation is when you're using someone else's computer, but in that case there's a lot of other things that can go wrong such as different distros and available software).

unconed commented 13 years ago

Looks good, thanks everyone for your input. I will try and get this working soon.

As for the issue of whether we should clarify the mapping to traditional commands... here's how I see it:

TermKit's goal is to be a more usable command shell. Therefor it seems logical to me that it should present commands like "show", "now" and "here" as if they were native, and act universally across platforms. If this means wrapping a different native command on each platform, so be it, but obvious we should aim for uniformity and least-invasion wherever possible.

As for scripting, I've explained elsewhere that I feel Bash is a terrible scripting language, and trying to make something that does both command execution and full stateful scripting is a bad idea. I'd much rather just type "node" or "ruby" and go into a sub-shell where I get autocompletion and rich output for that.

The number of cases where you have to invoke traditional unix utilities in script are much less when you have a real standard library at your disposal. But if you still want to, it shouldn't be too much of a problem. In theory, nothing prevents TermKit's node.js built-ins from being run stand-alone (headless) just by adding an appropriate preamble. Thus, we can implement most of these as aliases, and implement the platform-unifying ones as built-in commands that can run stand-alone. You get the best of both worlds. Some magic glue will be required, but I think it can be done.

d3x7r0 commented 13 years ago

here could be whereami since at least on linux you usually have the corresponding command whoami to know which user you're logged in under

CoderPuppy commented 12 years ago

as-admin could be generalized to as-user passing in the user to run it as. admin could then run it as admin basically sudo.