[sugar] Sugar and the commandline

Axel Liljencrantz liljencrantz
Sun Aug 27 20:31:40 EDT 2006


Hi,

I am sorry if this has already been discussed elsewhere, but I could
find no mention of this on the list. If I have missed something,
please feel free to redirect me to where this has been handled
previously.

I was wondering if anyone had thought about whether sugar should
provide any form of commandline. I realise this is a kid's computer,
not a Unix hacker's computer, however:

* Many kids are really smart, they'll want a system that grows with
them. A shell makes the computer much more 'tinker friendly'.
* I assume that like pretty much every other unix system, the OLPC
will have various bootscrits and other system files that use
shellscript. Kids are curious. They will find these scripts. It makes
sense that they should be provided with a way to figure out how they
work and write their own.
* What is the point of making Sugar open source if the users aren't
given the chance to poke at the internals themselves? A shell gives
the user an excellent 'behind the scenes' view of a system.

Also, if a commandline _is_ included, I have a weird suggestion: As a
shell, use fish. Fish is a GPL:ed non-Posix shell that I am the main
author of. More info about fish is available at
http://roo.no-ip.org/fish. It's in Fedora extras, so fedora users can
get it using 'yum install fish'.

Some arguments for its use:

* The fact that fish is not Posix-compatible is not a big problem
since none of the kids will be very likely to already be familiar with
bash.

* Fish has a significantly reduced syntax when compared to other
shells. There are fewer builtins, fewer types of quotes, and a much
more uniform syntax. This should make it significantly easier to learn
how to use.

* Fish features syntax highlighting. Commands, wildcards, quoted
strings, IO redirections and various other parts of the command can be
configured to be shown in different colors. Kids like happy colorful
things, and colors even help them learn. This is true for adults as
well. :-)

* Fish tries to be verbose and user friendly in it's error messages.
Often, there are suggestions on how to proceed in the error messages.

* Fish provides fixes for a great many  beginner problems in other
shells. For example, one can create variables whose value is shared
between all running shells and automatically saved/restored across
reboots. This is a very convenient way to change configuration
options. Fish is also integrated with the X clipboard, so ^K, ^Y and
friends will use the X clipboard. Variables are not tokenized on
spaces so there is no need to enclose every single variable expansion
with quotes. Arrays are easy to use, including simple and convenient
array slicing operations.

* Fish has very advanced tab completion support. This includes
completion of switches to commands, and a huge number of command
specific completions. Also, almost all completions have descriptions.
For example, if you type 'man who' you will be greeted with a list of
all manual pages beginning with 'who' and a short description of what
each of them contains, taken from the whatis database.

* The fish binary is small, less than half the size of bash on a Fedora system.

* Fish internally uses only wide character strings, meaning it's
memory usage is potentially large. This can be fixed relatively easy,
since fish dynamically loads most of the things that use significant
amounts of memory, namely functions and command specific completions.
By implementing an automatic unloader that makes sure that e.g. only
ten completions and ten functions are loaded at any given time, memory
usage can be kept low.

* Fish is well suited for a system with no disk. For example fish does
not use an in-memory list of existing commands. Since permanent
storage is very fast on disk less systems, such a list will only take
up a lot of memory with no noticeable performance increase.

I realise that I, as the main fish author, am not a pillar of
objectivity, but in my eyes, fish seems to be pretty suitable for the
OLPC. The main problem I see with using fish as the shell on
OLPC/sugar systems is that fish is only available in English, German,
French and Swedish. L10n needed. And since fish tries to be verbose,
and since fish has description strings for switches of a huge number
of commands, the number of strings to translate is huge.

-- 
Axel


More information about the Sugar-devel mailing list