replbase 0.0.47__tar.gz → 0.0.49__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.47 → replbase-0.0.49}/PKG-INFO +1 -1
- {replbase-0.0.47 → replbase-0.0.49}/pyproject.toml +1 -1
- {replbase-0.0.47 → replbase-0.0.49}/replbase/repl_base.py +25 -0
- {replbase-0.0.47 → replbase-0.0.49}/LICENSE +0 -0
- {replbase-0.0.47 → replbase-0.0.49}/README.md +0 -0
- {replbase-0.0.47 → replbase-0.0.49}/replbase/__init__.py +0 -0
- {replbase-0.0.47 → replbase-0.0.49}/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.49"
|
|
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"
|
|
@@ -371,6 +371,31 @@ class ReplBase:
|
|
|
371
371
|
key = keys[choice - 1]
|
|
372
372
|
return choices[key]
|
|
373
373
|
|
|
374
|
+
def input_obj_update(self, obj: dict[str, Any]) -> Any:
|
|
375
|
+
|
|
376
|
+
prop_name = self.input_choice(
|
|
377
|
+
"Select property to update: ", choices=list(obj.keys())
|
|
378
|
+
)
|
|
379
|
+
prop = obj[prop_name]
|
|
380
|
+
|
|
381
|
+
if not prop:
|
|
382
|
+
self.warn("Invalid selection")
|
|
383
|
+
return None
|
|
384
|
+
|
|
385
|
+
prompt = f"Enter value for {prop_name}: "
|
|
386
|
+
if prop is str | list[str]:
|
|
387
|
+
return self.input(prompt)
|
|
388
|
+
if prop is int | list[int]:
|
|
389
|
+
return self.input_int(prompt)
|
|
390
|
+
if prop is bool:
|
|
391
|
+
return self.input_bool(prompt)
|
|
392
|
+
if isinstance(prop, EnumType):
|
|
393
|
+
return self.get_enum_val(prompt, prop)
|
|
394
|
+
if isinstance(prop, Enum):
|
|
395
|
+
return self.get_enum_val(prompt, type(prop))
|
|
396
|
+
self.warn("Invalid property type")
|
|
397
|
+
return None
|
|
398
|
+
|
|
374
399
|
def get_enum_val(self, prompt: str, enum_cls: EnumType) -> Enum:
|
|
375
400
|
"""Prompt the user to select an enum value
|
|
376
401
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|