We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac50c79 commit 0f55395Copy full SHA for 0f55395
src/yes.py
@@ -0,0 +1,24 @@
1
+#!/usr/bin/python3
2
+
3
+import sys
4
+from optparse import OptionParser
5
6
7
+def yes(_, strings: list[str]):
8
+ try:
9
+ string = " ".join(strings or ["y"])
10
+ while True:
11
+ print(string)
12
+ except KeyboardInterrupt:
13
+ sys.exit(130)
14
15
16
+if __name__ == "__main__":
17
+ parser = OptionParser(
18
+ usage="Usage: %prog [STRING]...",
19
+ description="Repeatedly output a line with STRING(s) (or 'y' by default).",
20
+ add_help_option=False,
21
+ )
22
+ parser.add_option("--help", action="help", help="show usage information and exit")
23
24
+ yes(*parser.parse_args())
0 commit comments