Skip to content

Commit b0e1be4

Browse files
committed
Make cli to read stdin
1 parent c3ad1dc commit b0e1be4

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

ygka/cli/retrieve_stdin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import sys
2+
3+
_stdin = None if sys.stdin.isatty() else sys.stdin.read()
4+
5+
6+
def retrieve_stdin():
7+
return _stdin

ygka/cli/ygka.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from rich import print as pprint
22

33
from .cli_app import cli_app
4+
from .retrieve_stdin import retrieve_stdin
45

56

67
@cli_app.command()
7-
def ygka_command():
8-
pprint('[bold]Hello World![/bold]')
8+
def ygka_command(query: str):
9+
stdin = retrieve_stdin()
10+
pprint({'stdin': stdin, 'query': query})

0 commit comments

Comments
 (0)