Skip to content

Commit 9fd0344

Browse files
authored
Merge pull request #4 from code-yeongyu/feature/cli-stdin
Make cli to read stdin
2 parents 65ad89f + 67e43b4 commit 9fd0344

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ allow_split_before_dict_value = false
3636

3737
[tool.ruff]
3838
line-length = 119
39-
select = ["PLE", "PLR", "PLW", "E", "W", "F", "I", "Q", "C", "B"]
39+
select = ["PLE", "PLR", "PLW", "E", "W", "F", "I", "Q"]
4040

4141
[tool.pytest.ini_options]
4242
addopts = ["--cov=ygka"]

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)