Accept stdin in .insert-string widget? #291
-
|
I wanted to have a function that could be piped into and write the input to the next command line. I tried: Although the others options work, piping would be more intuitive and I don't understand why it doesn't work, the zsh version works fine: Also, by the way, this widget is very useful for interactive scripts, couldn't it be renamed/wrapped to something simpler like |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
-
|
I see, well I wish there could be a user facing function that replaces the command line. By the way, |
Beta Was this translation helpful? Give feedback.
-
|
In commit 2a524f3, I have implemented This is an example: $ ble append-line 'echo hello'[RET]
$ echo helloThis command can be used in subshells (which doesn't seem to be possible with Zsh's $ (ble append-line 'echo hello');(ble append-line 'echo world')[RET]
$ echo hello
echo worldOf course, this can be used to insert the commands read from a pipe: $ { echo echo hello; echo echo world; } | ble append-line "$(cat)"
$ echo hello
echo world |
Beta Was this translation helpful? Give feedback.
-
|
Awesome work, I really like this feature! |
Beta Was this translation helpful? Give feedback.
In commit 2a524f3, I have implemented
ble append-line <string>, which appends a line to the next command line.This is an example:
This command can be used in subshells (which doesn't seem to be possible with Zsh's
print -z). This command can be called multiple times to insert multiple lines.Of course, this can be used to insert the commands read from a pipe:
$ { echo echo hello; echo echo world; } | ble append-line "$(cat)" $ echo hello echo world