replbase 0.0.53__tar.gz → 0.0.55__tar.gz
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.
- {replbase-0.0.53 → replbase-0.0.55}/PKG-INFO +1 -1
- {replbase-0.0.53 → replbase-0.0.55}/pyproject.toml +1 -1
- {replbase-0.0.53 → replbase-0.0.55}/replbase/repl_base.py +20 -14
- {replbase-0.0.53 → replbase-0.0.55}/LICENSE +0 -0
- {replbase-0.0.53 → replbase-0.0.55}/README.md +0 -0
- {replbase-0.0.53 → replbase-0.0.55}/replbase/__init__.py +0 -0
- {replbase-0.0.53 → replbase-0.0.55}/replbase/cmd_meta.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "replbase"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.55"
|
|
8
8
|
description = "\"Combination of other REPL tools into a reusable class that generates a REPL\""
|
|
9
9
|
authors = [ "Joseph Bochinski <stirgejr@gmail.com>",]
|
|
10
10
|
license = "MIT"
|
|
@@ -379,22 +379,25 @@ class ReplBase:
|
|
|
379
379
|
prop = obj[prop_name]
|
|
380
380
|
|
|
381
381
|
if not prop:
|
|
382
|
-
self.warn("
|
|
383
|
-
return None
|
|
382
|
+
self.warn(f"{prop_name} is an invalid selection")
|
|
383
|
+
return prop_name, None
|
|
384
384
|
|
|
385
385
|
prompt = f"Enter value for {prop_name}: "
|
|
386
|
+
value = prop
|
|
386
387
|
if prop is str | list[str]:
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
388
|
+
value = self.input(prompt)
|
|
389
|
+
elif prop is int | list[int]:
|
|
390
|
+
value = self.input_int(prompt)
|
|
391
|
+
elif prop is bool:
|
|
392
|
+
value = self.input_bool(prompt)
|
|
393
|
+
elif isinstance(prop, EnumType):
|
|
394
|
+
value = self.get_enum_val(prompt, prop)
|
|
395
|
+
elif isinstance(prop, Enum):
|
|
396
|
+
value = self.get_enum_val(prompt, type(prop))
|
|
397
|
+
else:
|
|
398
|
+
self.warn("Invalid property type")
|
|
399
|
+
return prop_name, prop
|
|
400
|
+
return prop_name, value
|
|
398
401
|
|
|
399
402
|
def get_enum_val(self, prompt: str, enum_cls: EnumType) -> Enum:
|
|
400
403
|
"""Prompt the user to select an enum value
|
|
@@ -459,7 +462,7 @@ class ReplBase:
|
|
|
459
462
|
self.commands[cmd_name] = new_cmd
|
|
460
463
|
return new_cmd
|
|
461
464
|
|
|
462
|
-
def gen_command(self, cmd_name: str) -> ReplCommand:
|
|
465
|
+
def gen_command(self, cmd_name: str, hyphenate: bool = True) -> ReplCommand:
|
|
463
466
|
if not hasattr(self, cmd_name):
|
|
464
467
|
return
|
|
465
468
|
|
|
@@ -468,6 +471,9 @@ class ReplBase:
|
|
|
468
471
|
if not callable(cmd):
|
|
469
472
|
return
|
|
470
473
|
|
|
474
|
+
if hyphenate:
|
|
475
|
+
cmd_name = cmd_name.replace("_", "-")
|
|
476
|
+
|
|
471
477
|
return CommandMeta(func=cmd, register_cmd=self.add_command).gen_command()
|
|
472
478
|
|
|
473
479
|
def setup_cmds(self, *cmd_names: list[str]) -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|