Use str:has-prefix in place of has-prefix

This commit is contained in:
Ajeet D'Souza 2021-04-08 16:51:06 +05:30
parent 95c83d0b70
commit 34fb411965
2 changed files with 8 additions and 4 deletions

View file

@ -22,6 +22,7 @@ impl Generator for Elvish {
let result = format!( let result = format!(
r#" r#"
use str;
edit:completion:arg-completer[{bin_name}] = [@words]{{ edit:completion:arg-completer[{bin_name}] = [@words]{{
fn spaces [n]{{ fn spaces [n]{{
repeat $n ' ' | joins '' repeat $n ' ' | joins ''
@ -31,7 +32,7 @@ edit:completion:arg-completer[{bin_name}] = [@words]{{
}} }}
command = '{bin_name}' command = '{bin_name}'
for word $words[1:-1] {{ for word $words[1:-1] {{
if (has-prefix $word '-') {{ if (str:has-prefix $word '-') {{
break break
}} }}
command = $command';'$word command = $command';'$word

View file

@ -29,6 +29,7 @@ fn elvish() {
} }
static ELVISH: &str = r#" static ELVISH: &str = r#"
use str;
edit:completion:arg-completer[my_app] = [@words]{ edit:completion:arg-completer[my_app] = [@words]{
fn spaces [n]{ fn spaces [n]{
repeat $n ' ' | joins '' repeat $n ' ' | joins ''
@ -38,7 +39,7 @@ edit:completion:arg-completer[my_app] = [@words]{
} }
command = 'my_app' command = 'my_app'
for word $words[1:-1] { for word $words[1:-1] {
if (has-prefix $word '-') { if (str:has-prefix $word '-') {
break break
} }
command = $command';'$word command = $command';'$word
@ -90,6 +91,7 @@ fn build_app_special_commands() -> App<'static> {
} }
static ELVISH_SPECIAL_CMDS: &str = r#" static ELVISH_SPECIAL_CMDS: &str = r#"
use str;
edit:completion:arg-completer[my_app] = [@words]{ edit:completion:arg-completer[my_app] = [@words]{
fn spaces [n]{ fn spaces [n]{
repeat $n ' ' | joins '' repeat $n ' ' | joins ''
@ -99,7 +101,7 @@ edit:completion:arg-completer[my_app] = [@words]{
} }
command = 'my_app' command = 'my_app'
for word $words[1:-1] { for word $words[1:-1] {
if (has-prefix $word '-') { if (str:has-prefix $word '-') {
break break
} }
command = $command';'$word command = $command';'$word
@ -176,6 +178,7 @@ fn build_app_with_aliases() -> App<'static> {
} }
static ELVISH_ALIASES: &str = r#" static ELVISH_ALIASES: &str = r#"
use str;
edit:completion:arg-completer[cmd] = [@words]{ edit:completion:arg-completer[cmd] = [@words]{
fn spaces [n]{ fn spaces [n]{
repeat $n ' ' | joins '' repeat $n ' ' | joins ''
@ -185,7 +188,7 @@ edit:completion:arg-completer[cmd] = [@words]{
} }
command = 'cmd' command = 'cmd'
for word $words[1:-1] { for word $words[1:-1] {
if (has-prefix $word '-') { if (str:has-prefix $word '-') {
break break
} }
command = $command';'$word command = $command';'$word