Powerful scripting language & versatile interactive shell add sylixos support.
Go to file
2016-01-27 19:16:41 +00:00
edit edit: suspend the reader when the writer is active. 2016-01-27 13:04:15 +00:00
errutil errutil: add tests 2016-01-24 18:14:57 +01:00
eval eval: add $paths 2016-01-27 19:16:41 +00:00
parse parse: make backup after a read of EOF behave correctly 2016-01-26 14:54:24 +01:00
print Move util/deepprint{"" _test}.go into print package 2015-02-26 17:10:37 +01:00
samples Reorganize sample scripts 2015-02-25 15:09:42 +01:00
screenshots Capture screenshots with subpixel AA turned off 2014-07-28 11:28:43 +08:00
store Shorter method names of Store 2015-02-26 00:09:53 +01:00
strutil Move util/strings{"" _test} into dedicated strutil package 2015-02-26 17:04:07 +01:00
sys Use go generate; clean up Makefile 2015-02-27 02:29:40 +01:00
sysutil Move util/path.go into dedicated sysutil package 2015-02-26 16:50:20 +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 Apparently "go tip" is the development version instead of latest release 2015-08-24 12:34:06 +08:00
Dockerfile Adding a Dockerfile 2014-07-29 21:12:39 -07:00
LICENSE Project rename: das -> elvish 2014-01-29 18:44:07 +08:00
main.go Store a pointer to eval.Evaler in edit.Editor 2016-01-25 22:14:12 +01:00
Makefile Use go generate; clean up Makefile 2015-02-27 02:29:40 +01:00
README.md rework README more 2016-01-27 00:19:48 +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
    ~> * (+ 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:

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

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

    ~> map [x]{+ 10 $x} [1 2 3]
    [11 12 13]
    ~> map [x]{/ $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]{/ $x 2}
    ▶ 5.5
    ▶ 6
    ▶ 6.5
    
  • A separate env: namespace for environmental variables:

    ~> put $env:HOME
    ▶ /home/xiaq
    ~> set $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.

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.

Building

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

Linux is fully supported. I also try to ensure that it compiles on FreeBSD, which means it will also likely compile on other BSDs and Mac OS X. Windows is not yet supported, but it might be in future.

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).

Archlinux users can also try the AUR package elvish-git.

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 make pre-commit to re-generate them in case you modified the source. Read the Makefile for details.

Formatting the Code

Always format the code with goimports before committing. Run go get code.google.com/p/go.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

.gitattributes in this repository refers to this filter. Read 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 section.