wizlib 3.1.4__py3-none-any.whl → 3.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wizlib/io.py
CHANGED
|
@@ -5,8 +5,10 @@ import sys
|
|
|
5
5
|
|
|
6
6
|
import readchar
|
|
7
7
|
|
|
8
|
+
from wizlib.parser import WizArgumentError
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
ISATTY = all(s.isatty() for s in (sys.stdin, sys.stdout, sys.stderr))
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
def isatty():
|
|
@@ -18,4 +20,8 @@ def stream():
|
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
def ttyin():
|
|
21
|
-
|
|
23
|
+
if ISATTY:
|
|
24
|
+
return readchar.readkey()
|
|
25
|
+
else:
|
|
26
|
+
raise WizArgumentError(
|
|
27
|
+
'Command designed for interactive use')
|
wizlib/stream_handler.py
CHANGED
|
@@ -16,18 +16,27 @@ class StreamHandler(Handler):
|
|
|
16
16
|
name = 'stream'
|
|
17
17
|
text: str = ''
|
|
18
18
|
|
|
19
|
-
def __init__(self, file=None
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
def __init__(self, file=None):
|
|
20
|
+
self.file = file
|
|
21
|
+
|
|
22
|
+
def read(self):
|
|
23
|
+
"""Play like a file, sorta"""
|
|
24
|
+
if self.file:
|
|
25
|
+
return Path(self.file).read_text()
|
|
26
|
+
else:
|
|
27
|
+
return wizlib.io.stream()
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def text(self):
|
|
31
|
+
"""Legacy approach - deprecated"""
|
|
32
|
+
return self.read()
|
|
33
|
+
|
|
34
|
+
# def __str__(self):
|
|
35
|
+
# return self.text
|
|
36
|
+
|
|
37
|
+
# @classmethod
|
|
38
|
+
# def fake(cls, value):
|
|
39
|
+
# """Return a fake StreamHandler with forced values, for testing"""
|
|
40
|
+
# handler = cls(stdin=False)
|
|
41
|
+
# handler.text = value
|
|
42
|
+
# return handler
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wizlib
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.2.0
|
|
4
4
|
Summary: Framework for flexible and powerful command-line applications
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Steampunk Wizard
|
|
@@ -43,4 +43,3 @@ WizLib wraps the built-in ArgumentParser with a set of functions, classes, and c
|
|
|
43
43
|
Logo by [Freepik](https://www.freepik.com/?_gl=1*1y9rvc9*test_ga*Mjc1MTIzODYxLjE2ODA3OTczNTg.*test_ga_523JXC6VL7*MTY4MDc5NzM1OC4xLjEuMTY4MDc5NzQxNS4zLjAuMA..*fp_ga*Mjc1MTIzODYxLjE2ODA3OTczNTg.*fp_ga_1ZY8468CQB*MTY4MDc5NzM1OC4xLjEuMTY4MDc5NzQxNS4zLjAuMA..)
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
|
|
@@ -5,9 +5,9 @@ wizlib/command.py,sha256=NO1558EYuXxfkpSmX6ljjzae8n8g4w6yytZKTJtigvo,1708
|
|
|
5
5
|
wizlib/config_handler.py,sha256=hoDavSMiGM_7PAHI8XIwC8nxPWOZDk302ryyjluoLGg,2588
|
|
6
6
|
wizlib/error.py,sha256=ypwdMOYhtgKWd48ccfOX8idmCXmm-Skwx3gkPwqJB3c,46
|
|
7
7
|
wizlib/handler.py,sha256=Oz80aPhDyeY9tdppZ1dvtN-19JU5ydEDVW6jtppVoD4,446
|
|
8
|
-
wizlib/io.py,sha256=
|
|
8
|
+
wizlib/io.py,sha256=vZ1pIMtPFUZxbOv10HFDezEmlPgwPlUVP6RPwtfM9ec,506
|
|
9
9
|
wizlib/parser.py,sha256=yLHV0fENeApFomCRWa3I6sB1x4lk1ag4vKejWVsic64,1550
|
|
10
|
-
wizlib/stream_handler.py,sha256=
|
|
10
|
+
wizlib/stream_handler.py,sha256=7y1ckUoqTXxaCFI-XEixdBFZQZDxOv2jEEwtjWHZsUA,1066
|
|
11
11
|
wizlib/super_wrapper.py,sha256=msitlfFfEwnrskzTtQBEY975sh9TQPicdLVo67imuqU,315
|
|
12
12
|
wizlib/test_case.py,sha256=T5cX7yWy94hf8JuherDeBCH9Gve5tx2x_PZOte4udC0,1017
|
|
13
13
|
wizlib/ui/__init__.py,sha256=ve_p_g4aBujh4jIJMgKkJ6cE5PT0aeY5AgRlneDswGg,4241
|
|
@@ -15,6 +15,6 @@ wizlib/ui/shell/__init__.py,sha256=sPrYe4bG_Xf7Nwssx_dqXVk9jeyYBFUjh4oLdlSOeRY,9
|
|
|
15
15
|
wizlib/ui/shell/line_editor.py,sha256=vXXsCS_i4ZCjP0su2X9W_yD1CS6MiazPAtxpiaXQ6Jc,7413
|
|
16
16
|
wizlib/ui/shell_ui.py,sha256=jre7E_5vP_SceNH7GYenfXZpFf4h9Sbh9cWZZycTYk8,1911
|
|
17
17
|
wizlib/ui_handler.py,sha256=JoZadtw9DKAtGvHKP3_BJF2NaYqmcQYNdsY4PeRnOjg,634
|
|
18
|
-
wizlib-3.
|
|
19
|
-
wizlib-3.
|
|
20
|
-
wizlib-3.
|
|
18
|
+
wizlib-3.2.0.dist-info/METADATA,sha256=rKb5cRkQEpv_YjanZXOcPoGyDAz_86TjB67UNor42IM,1779
|
|
19
|
+
wizlib-3.2.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
20
|
+
wizlib-3.2.0.dist-info/RECORD,,
|