Skip to content

Commit b4ad8c1

Browse files
committed
Stdin mode
1 parent 2e23a67 commit b4ad8c1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

interpreter/terminal_interface/start_terminal_interface.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@ def start_terminal_interface(interpreter):
294294
"attr_name": "plain_text_display",
295295
},
296296
},
297+
{
298+
"name": "stdin",
299+
"help_text": "Run OI in stdin mode",
300+
"type": bool,
301+
},
297302
]
298303

299304
# i shortcut
@@ -508,7 +513,7 @@ def print_help(self, *args, **kwargs):
508513
### Check for update
509514

510515
try:
511-
if not interpreter.offline:
516+
if not interpreter.offline and not args.stdin:
512517
# This message should actually be pushed into the utility
513518
if check_for_update():
514519
display_markdown_message(
@@ -551,7 +556,13 @@ def print_help(self, *args, **kwargs):
551556

552557
contribute_conversation_launch_logic(interpreter)
553558

554-
interpreter.chat()
559+
# Standard in mode
560+
if args.stdin:
561+
stdin_input = input()
562+
interpreter.plain_text_display = True
563+
interpreter.chat(stdin_input)
564+
else:
565+
interpreter.chat()
555566

556567

557568
def set_attributes(args, arguments):

0 commit comments

Comments
 (0)