Merge pull request #3285 from cherryblossom000/elvish-0.17

fix(complete): Use Elvish v0.17 lambda syntax
This commit is contained in:
Ed Page 2022-01-11 19:34:01 -06:00 committed by GitHub
commit df0e6d8637
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View file

@ -25,11 +25,11 @@ impl Generator for Elvish {
use builtin;
use str;
set edit:completion:arg-completer[{bin_name}] = [@words]{{
fn spaces [n]{{
set edit:completion:arg-completer[{bin_name}] = {{|@words|
fn spaces {{|n|
builtin:repeat $n ' ' | str:join ''
}}
fn cand [text desc]{{
fn cand {{|text desc|
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
}}
var command = '{bin_name}'

View file

@ -34,11 +34,11 @@ static ELVISH: &str = r#"
use builtin;
use str;
set edit:completion:arg-completer[my_app] = [@words]{
fn spaces [n]{
set edit:completion:arg-completer[my_app] = {|@words|
fn spaces {|n|
builtin:repeat $n ' ' | str:join ''
}
fn cand [text desc]{
fn cand {|text desc|
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
}
var command = 'my_app'
@ -94,11 +94,11 @@ static ELVISH_SPECIAL_CMDS: &str = r#"
use builtin;
use str;
set edit:completion:arg-completer[my_app] = [@words]{
fn spaces [n]{
set edit:completion:arg-completer[my_app] = {|@words|
fn spaces {|n|
builtin:repeat $n ' ' | str:join ''
}
fn cand [text desc]{
fn cand {|text desc|
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
}
var command = 'my_app'
@ -180,11 +180,11 @@ static ELVISH_ALIASES: &str = r#"
use builtin;
use str;
set edit:completion:arg-completer[cmd] = [@words]{
fn spaces [n]{
set edit:completion:arg-completer[cmd] = {|@words|
fn spaces {|n|
builtin:repeat $n ' ' | str:join ''
}
fn cand [text desc]{
fn cand {|text desc|
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
}
var command = 'cmd'