Powerful scripting language & versatile interactive shell add sylixos support.
Go to file
Qi Xiao 34c0d96830 Query HOME consistently.
A bug with osutil.Getcwd was also fixed. This fixes #91.
2016-02-11 23:43:48 +01:00
edit When starting ReadLine, reset old buffer of the writer. 2016-02-11 23:15:17 +01:00
errutil Report multiple errors in ReadLine. 2016-02-11 21:45:27 +01:00
eval Use basic readline when stdin is not tty or editor errored. 2016-02-11 19:32:40 +01:00
glob glob: Remove unused func. 2016-02-09 00:05:34 +01:00
logutil logutil.Sink -> .Discard 2016-02-08 20:51:44 +01:00
osutil Query HOME consistently. 2016-02-11 23:43:48 +01:00
parse Add a test case against parse.Parse. 2016-02-11 22:59:21 +01:00
print Package docs. 2016-02-07 22:16:27 +01:00
store Query HOME consistently. 2016-02-11 23:43:48 +01:00
strutil golint fixes. 2016-02-07 23:23:16 +01:00
sys Put myself in foreground after pipeline finishes. 2016-02-11 18:59:18 +01:00
.gitattributes Use .gitattributes to filter go sources through goimports 2014-02-10 12:41:16 +08:00
.gitignore In Makefile, shorten coverage to cover 2014-09-24 23:56:12 +02:00
.travis.yml Give up the attempt of using Travis to upload artifacts. 2016-02-09 23:54:28 +01:00
Dockerfile update Dockerfile 2016-02-09 16:43:58 +08:00
LICENSE Project rename: das -> elvish 2014-01-29 18:44:07 +08:00
main.go Use basic readline when stdin is not tty or editor errored. 2016-02-11 19:32:40 +01:00
Makefile Change uploading URL. 2016-02-11 21:16:34 +01:00
README.md linux -> Linux 2016-02-10 01:18:06 +01:00

A novel Unix shell

GoDoc Build Status

This project aims to explore the potentials of the Unix shell. It is a work in progress; things will change without warning.

The Interface

Syntax highlighting (also showcasing right-hand-side prompt):

syntax
highlighting

Tab completion for files:

tab completion

Navigation mode (triggered with ^N, inspired by ranger):

navigation mode

Planned features:

  • Auto-suggestion (like fish)
  • Programmable line editor
  • Directory jumping (#27)
  • A vi keybinding that makes sense
  • History listing (like ptpython)
  • Intuitive multiline editing

The Language

Some things that the language is already capable of:

  • External programs and pipelines: (~> is the prompt):

    ~> vim README.md
    ...
    ~> cat -v /dev/random
    ...
    ~> dmesg | grep -i acpi
    ...
    
  • Arithmetics using the prefix notation:

    ~> + 1 2
    ▶ 3
    ~> mul (+ 1 2) 3
    ▶ 9
    
  • Quoting:

    ~> echo "|  C'est pas une pipe."
    |  C'est pas une pipe.
    
  • Lists and maps:

    ~> println list: [a list] map: [&key value]
    list: [a list] map: [&key value]
    ~> println [a b c][0]
    a
    ~> println [&key value][key]
    value
    
  • Variables:

    ~> v=[&foo bar]; put $v[foo]
    ▶ bar
    
  • Defining functions:

    ~> fn map [f xs]{ put [(put $@xs | each $f)] }
    
  • Lisp-like functional programming:

    ~> map [x]{+ 10 $x} [1 2 3]
    [11 12 13]
    ~> map [x]{div $x 2} (map [x]{+ 10 $x} [1 2 3])
    [5.5 6 6.5]
    
  • More natural concatenative style:

    ~> put 1 2 3 | each [x]{+ 10 $x} | each [x]{div $x 2}
    ▶ 5.5
    ▶ 6
    ▶ 6.5
    
  • A separate env: namespace for environmental variables:

    ~> put $env:HOME
    ▶ /home/xiaq
    ~> env:PATH=$env:PATH":/bin"
    

The language is not yet complete. Notably, control structures like if and while are not yet implemented. The issues list contain some of things I'm currently working on.

Getting elvish

Prebuilt binaries

Prebuilt binaries are available for 64-bit Linux and Mac OS X. They are always built using the latest commit that builds.

Building It Yourself

Go >= 1.4 is required. This repository is a go-getable package.

Linux and FreeBDS are fully supported. It is likely to work on other BSDs and Mac OS X. Windows is not supported yet.

In case you are new to Go, you are advised to read How To Write Go Code, but here is a quick snippet:

export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
go get github.com/elves/elvish
elvish

To update and rebuild:

go get -u github.com/elves/elvish

Remember to put the two exports above into your bashrc or zshrc (or whatever).

Notes for Contributors

Testing

Always run unit tests before committing. make will take care of this.

Generated files

Some files are generated from other files. They should be commmited into the repository for this package to be go-getable. Run go generate ./... to regenerate them in case you modified the source.

Formatting the Code

Always format the code with goimports before committing. Run go get golang.org/x/tools/cmd/goimports to install goimports, and goimports -w . to format all golang sources.

To automate this you can set up a goimports filter for Git by putting this in ~/.gitconfig:

[filter "goimports"]
    clean = goimports
    smudge = cat

Git will then always run goimports for you before comitting, since .gitattributes in this repository refers to this filter. More about Git attributes and filters here.

Licensing

By contributing, you agree to license your code under the same license as existing source code of elvish. See the LICENSE file.

Name

In roguelikes, items made by the elves have a reputation of high quality. These are usually called elven items, but I chose elvish for an obvious reason.

The adjective for elvish is also "elvish", not "elvishy" and definitely not "elvishish".

It is not directly related to the fictional elvish language, but I believe there is not much room for confusion and the google-ability is still pretty good.