set 'tee'
#8885
Replies: 1 comment 1 reply
-
It seems ps. I guess arguably the function as proposed is really more like a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Personally I have observed that I often want to store the output of a complex command, while also immediately rendering it inline. Hence the 'tee' analogy. A toy example would be
touch /tmp/(set id (seq 100 | fzf); echo $id)
, allowing me to use $id in a subsequent command. Writing it out like this is clearly not DRY.I've attempted to implement this as a function, but the main problem is that it seems impossible to
set -f
using that, as the result would be scoped to the helper function, not the function calling it.My implementation follows:
function settee;set -g $argv[1] $argv[2..]; printf %s\n $argv[2..];end
used like this:
touch /tmp/(settee id (seq 10 | fzf).txt
It could be improved to a) be more tee-like by piping in the input items (
seq 10 | fzf | settee id
, b) support -U, -x, -u, -a and -p.My question is, is there some ordinary way I'm missing to make
-f
scope support possible -- without outright patchingset
itself?Beta Was this translation helpful? Give feedback.
All reactions