Elvish is a new Unix shell. Its design emphasizes an expressive scripting language as well as a polished user interface. It is implemented in go and BSD-licensed.
This page lists some ideas for a Summer of Code project for elvish. Each project consists of several subprojects, with increasing difficulties (rated on a scale of 5 starts). For projects consisting of more than two subprojects, doing two of the them is sufficient to qualify as a SoC project.
Although shells are traditionally tied to the terminal, graphical interfaces are not impossible. The terminal UI module, called the line editor, is only loosely coupled with the rest of elvish. Since elvish strives for portability, the best choice for GUI these days is a web interface.
Building a web interface for elvish has several advantages:
-
It makes the language more attractive to beginners, especially those not familiar with the terminal UI. For instance, Go, Haskell, Python and Ruby all support "trying out" in the browser.
-
Web interfaces enable us to interact with all kinds of media -- images, videos, audios, etc.. We have wonderful tools like ImageMagick and GraphicsMagick for manipulating images and ffmpeg for manipulating videos, it would be even more wonderful to see the output directly.
To start with, the line editor has a very simple API: calling its ReadLine
method promps the user for input and returns it. We can also get user input using a webpage, e.g. a textbox with a "submit" button. To achieve this, we need (besides building a webpage) to implement a HTTP server within elvish that can accept HTTP request, which is possible with the net/http package in the standard library.
Besides taking input from a web page, we also need to see the output of commands. Depending on the type of the command, seveal different strategies need to be implemented:
-
Many programs, like
cat
andgrep
, output simple text. Their output can be shown on the webpage as-is as long as it is properly escaped as HTML. -
Elvish functions can output elvish values, which can be strings, lists, maps, function closures and so on. While elvish values all have a string representation, it is much nicer if they can inspected in an interactive way -- for instance, deeply nested lists are collapsed and may be expanded using mouse clicks.
-
Other useful programs like
vim
asssumes that it is talking to a terminal, and will output special "escape sequences" to move the cursor, change the color of text, etc.. The easiest way to support such programs is by embedding a terminal emulator within the web interface. There are many JavaScript libraries that do this; google "javascript terminal emulation".
While the API of the line editor is deceptively simple, the line editor has a rich user interface. For instance, the user can use Tab to ask the shell how incomplete code may be completed - writing println $
and pressing Tab reveals a list of all variables. The user can also press Ctrl-N to enter "navigation mode", which mimics a file manager.
While it is possible for us to simply use the terminal emulation functionality in the previous subproject to show the line editor's user interface, it would be much nicer to reimplement such interfaces using HTML elements. For instance, an actual dropdown menu for the Tab completion list can look much more natural when using the shell from the web.
Now that we have a web interface we can build a public server for people to "try out" elvish. We want such a public server to allow access from any user. However, we also want to make sure that a user does not use too much resource, and data from different users are isolated. This can be implemented by building containers for elvish (using e.g. Docker or Kubernetes) and allocating them dynamically for users.
Implementing a quote
special form which, instead of evaluating the arguments, return a AST for the arguments. The AST should be inspectable from elvish.
This subproject serves as a preliminary to the following two subprojects, since both bash and zsh are mostly POSIX-conformant.
Elvish is not compatible with bash. Bash emulation is useful from two aspects:
-
Users migrating from bash can simply use their old
.bashrc
file. -
Some tools like virtualenv require you to
source
a (bash) script oreval
a (bash) snippet from the shell, because they need to (for instance) modify environment variables or override builtin functions. Such tools cannot be used from elvish directly unless we have a bash emulation mode.