开发者

Should terminal applications guess what the user wants?

开发者 https://www.devze.com 2023-01-27 22:33 出处:网络
There was a small discussion about what git does and doesn\'t do by default for the user. By default, colour is disabled (generally set up with git config), yet it sends its output to a pager applica

There was a small discussion about what git does and doesn't do by default for the user.

By default, colour is disabled (generally set up with git config), yet it sends its output to a pager application for certain commands (such as in git log).

One side to this would be that no flags should be enabled since it gives the user full control of the application. The contrary would state that when releasing a new application, one should try and win users over as quickly as possible开发者_运维百科 with as many bells and whistles as possible.

This is probably a very subjective question, but in the year 2010 should terminal applications start making usability decisions by default or force its users to customize it.


$ rm file.txt </dev/null
Do you want to remove file.txt [y/n]
tty not connected, guessing "no"

So no; please avoid any assumptions because they can turn out to be the exact opposite of what is expected.

Color in git diff is disabled by default, because pagers may not support it — this is the case even for less, which needs to be explicitly invoked with the -R option to turn on escape sequence support.


if there are conditions when something acts differently like in the case of color when the output is a tty vs a pipe it should be clear what this condition is but git log doesn't check for this but some other programs do like ls in it's --color=auto mode

in the case of git log with --color it uses less with color escape code pass though on

if you want to override it give them a like a --color[=WHEH] option like ls has which can force color on regardless of the type of the output

--color[=WHEN]         control whether color is used to distinguish file
                       types.  WHEN may be `never', `always', or `auto'

the auto mode is what i describe in the first paragraph

the default should be the one useful to the users of the program, if there are cases where that default isn't what is wanted that's what options are for


The terminal applications are no exceptions. See oracle import (imp) it provides sensible defaults so even though it asks questions but a default selection is given a naive user would go for it unless he is really sure about that option. or even create database in oracle which has a smaller version which assumes all sensible defaults and an extended version.

One side to this would be that no flags should be enabled since it gives the user full control of the application

User will learn to use full control if he actually starts using it. For instance I was evaluating workflow engines, open source ones, imagine for every workflow engine I needed to setup full infrastructure like database table structure before it even gets up and run. Instead one of the most sophisticated workflow engines gives nice HSQLDB implementation which works great for evaluation.

Once something starts working I can tweak it to suit me, rather than spending days on a software which seems quite dead in the beginning.

0

精彩评论

暂无评论...
验证码 换一张
取 消