error hint detailed error error hint. as shown above.
highlight
key-bindings
custom key-bindings supported,eg:
alt + m save bookmark
alt + x fuzzy search and execut
performance
memery usage
lume
fish
bash
dash
loop test
lume
fish
bash
dash
fish was unable to finish 1,000,000 times circle.
pakage size(after install)
lume
bash
dash
fish
version
v0.3.8
v5.2.037
v0.5.12
v4.0.2
size
4.3 MB
9.2 MB
153.8 KiB
21.64 MB
test result
as fish was unable to fishish one million times task, we take the time of its harf task
syntax
the snytax is user-friendly.
direct math
6 / 3 5 - 1 1+2^3*2
work with vars
let a = (2+3)*5 print"a=" a
let b,c = 1,2 # multi assign supported println b c println(b,c) # also works
work with array list
let arr = [10, "a", True] let arr_b = 0..10
# index arr[0] # → 10 arr_b.1
# slice arr[1:3] # → ["a", True](left close right open) arr[::2] # → [10, True](step is 2) arr[-1:] # → True(support negative slice)
# nested [1,24,5,[5,6,8]][3][1] # 6
work with map
let dict = {name: "Alice", age: 30}
# index dict[name] dict.name
if statement
if a>0 && b==0 { print OK }else{ print BAD }
match statement
match a { 10 => print"ten", 20 => print"twenty"# comma is optional _ => print other }
other statement also For, While, Loop supported. conditional assign: a?b:c lazy assign: let a := b + c
lambda expression
let addone = x -> x+1 let add = (x,y) -> x+y
addone(2) add(3,4)
function
support function as arg support function nest support default value suppport params collector
fn add(x,y=0,*other){ x+y+len(other) }
add(3) add(3,4) add(3,4,5,6,7)
error catch
let e = x -> print x 3 / 0 ?: e # you could use a function to catch and deel with errors
3 / 0 ?. # aslo, you may like to ignore it. 3 / 0 ?? # aslo, you may like to display it on stderr. 3 / 0 ?+ # aslo, you may like to merge it to stdout. 3 / 0 ?! # aslo, you may like to use error as result, useful to pipe errors out.
3 / 0 ?: 0 # give a default value while failing
error catch could be use in expression and whole function declare.
smart pipes Smart pipelines that can automatically adapt to input and output formats, intelligently supporting byte pipelines and structured data pipelines.
structured pipes :
ls -l | parse.cmd() | where( int C4 > 4000 ) # use normal ls command
let thead = [mode,i,user,group,size,mday,mtime,name] ls -l | parse.cmd(thead) | where(int size > 400) | select([name,size,mtime]) #parse with table head
fs.ls -l | where(mode==420) | select(name) # use builtin ls