shell_gpt icon indicating copy to clipboard operation
shell_gpt copied to clipboard

Accept stdin input

Open Shakahs opened this issue 1 year ago • 2 comments

It would be very useful to pipe stdin to sgpt, then ask a question about said input. For example:

cat data.json | sgpt "what is the oldest entry" cat script.py | sgpt "what does this script do?"

etc.

Shakahs avatar Mar 21 '23 21:03 Shakahs

But you can do the same thing with command substitution syntax, as it is described in readme:

sgpt "what is the oldest entry: $(cat data.json)"

TheR1D avatar Mar 22 '23 00:03 TheR1D

Perhaps, but it is not practical. Pipelining commands is a basic tenet of CLI usage and shell scripting. For SGPT to be the shell's interface to GPT it must support the IO capabilities expected of a shell utility. This is the third issue on the subject (see #35, #86) so clearly it is needed. I have created a pull request implementing it in #93.

Shakahs avatar Mar 24 '23 14:03 Shakahs