←back to thread

412 points conanxin | 4 comments | | HN request time: 0.435s | source
Show context
mg ◴[] No.41085093[source]
The command line is still king.

Whenever I see new coders struggle, it usually is because they:

    - Don't know the context of what they are executing

    - Don't know about the concept of input and output
On the command line, the context is obvious. You are in the context. The working dir, the environment, everything is the same for you as it is for the thing you execute via ./mything.py.

Input and output are also obvious. Input is what you type, output is what you see. Using pipes to redirect it comes naturally.

Not being natively connected to context, input and output is often at the core of problems I see even senior programmers struggle with.

replies(16): >>41085138 #>>41085178 #>>41085239 #>>41085304 #>>41085362 #>>41085446 #>>41085493 #>>41085513 #>>41085614 #>>41085677 #>>41085897 #>>41086268 #>>41086743 #>>41086819 #>>41087168 #>>41097209 #
jasode ◴[] No.41085446[source]
>On the command line, the context is obvious.

But CLI contexts are only obvious if the computer user is already familiar with the CLI which biases the learned mind to perceive things as obvious when they really are not.

A lot of CLI commands syntax are based on position instead of explicit argument names.

E.g. creating file system links via CLI has opposite syntax positions in Linux vs Windows:

  - Linux:  ln srcfile targetlink

  - Windows :  mklink targetlink srcfile
If one goes back & forth between the 2 operating systems, it's easy to mis-type the wrong syntax because the CLI doesn't make it obvious. On the other hand, using a GUI file browser like Ubuntu Nautlius or Windows Explorer lets a novice create links ("shortcuts") without memorizing CLI syntax.

This gap of knowledge is also why there is copy&paste cargo-culting of inscrutable ffmpeg, git, rsync, etc commands.

E.g. using ffmpeg to covert a DVD to mp4 by manually concatenating *.VOB files has very cumbersome and error-prone syntax. It's easier to use a visual GUI like Handbrake to click and choose the specific title/chapters to convert.

CLI vs GUI superiority depends on the task and the knowledge level of the user.

replies(2): >>41085490 #>>41085882 #
1. tjoff ◴[] No.41085490[source]
Context isn't the same as syntax?

Yes, command line suffers from discoverability of which different applications (such as ln/mklink) may not be consistent.

It is one of the bigger problems (imho) of the cli but it doesn't go against GPs point.

The command line does have a learning curve (partly because of the above), but it is also quite rewarding.

replies(1): >>41086183 #
2. sgc ◴[] No.41086183[source]
When I start typing a formula in LibreOffice Calc, there is a popup showing possible matching functions, then when I choose the function, the popup shows the required syntax for the function and where I currently am within that syntax. A bash plugin that would do that would be an absolute game changer imho.

The cli excels because it is extremely flexible, with far more options available than a set of buttons could ever display. But discoverability rounds down to 0, and there are footguns. It seems like spreadsheet software has found an almost drop in ui that would greatly enhance the cli.

replies(1): >>41086464 #
3. thinkmassive ◴[] No.41086464[source]
Tab completion can get you much of the way there.
replies(1): >>41086563 #
4. sgc ◴[] No.41086563{3}[source]
it's not the same thing. Tab completion is useful and will complete something you know of. But it does not help you discover something you don't know, or provide you the syntax of the command after it is entered. The problem I would like to solve is discoverability.

It's a 3 part problem: available commands, their options, their syntax. Part one would need to capture prompt input before enter was hit using solutions similar to those found at [1] perhaps the most useful but least complete one there is the one that uses apropos so something like `apropos -s 1 '' | sort | grep calc | less`. Similar solutions would be required for two and three. The roughest and easiest prototype would probably be two tabs in a split screen view, which would allow for selection of displayed matches to then modify the prompt creating those matches in the other tab. But Calc style popups directly attached to your cursor would be more useful still.

[1] https://stackoverflow.com/questions/948008/linux-command-to-...