argenta 1.0.7__tar.gz → 1.1.1__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.
- argenta-1.1.1/.github/workflows/mypy.yml +31 -0
- {argenta-1.0.7 → argenta-1.1.1}/.github/workflows/ruff.yml +2 -2
- {argenta-1.0.7 → argenta-1.1.1}/.github/workflows/tests.yml +5 -5
- {argenta-1.0.7 → argenta-1.1.1}/.gitignore +2 -1
- {argenta-1.0.7 → argenta-1.1.1}/PKG-INFO +10 -4
- {argenta-1.0.7 → argenta-1.1.1}/README.de.md +5 -1
- {argenta-1.0.7 → argenta-1.1.1}/README.md +8 -2
- {argenta-1.0.7 → argenta-1.1.1}/README.ru.md +5 -1
- argenta-1.1.1/metrics_tests/time_of_precycle_setup.py +33 -0
- argenta-1.1.1/mock/local_test.py +5 -0
- {argenta-1.0.7 → argenta-1.1.1}/mock/mock_app/main.py +5 -8
- argenta-1.1.1/mock/mock_app/routers.py +25 -0
- {argenta-1.0.7 → argenta-1.1.1}/pyproject.toml +6 -3
- argenta-1.1.1/src/argenta/__init__.py +10 -0
- argenta-1.1.1/src/argenta/app/__init__.py +12 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/app/autocompleter/entity.py +18 -19
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/app/defaults.py +0 -1
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/app/dividing_line/models.py +5 -5
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/app/models.py +129 -118
- argenta-1.1.1/src/argenta/app/protocols.py +22 -0
- argenta-1.1.1/src/argenta/app/registered_routers/entity.py +27 -0
- argenta-1.1.1/src/argenta/command/__init__.py +12 -0
- argenta-1.1.1/src/argenta/command/exceptions.py +49 -0
- argenta-1.1.1/src/argenta/command/flag/__init__.py +11 -0
- argenta-1.1.1/src/argenta/command/flag/defaults.py +27 -0
- argenta-1.1.1/src/argenta/command/flag/flags/__init__.py +10 -0
- argenta-1.1.1/src/argenta/command/flag/flags/models.py +106 -0
- argenta-1.1.1/src/argenta/command/flag/models.py +119 -0
- argenta-1.1.1/src/argenta/command/models.py +151 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/metrics/main.py +2 -2
- argenta-1.1.1/src/argenta/orchestrator/__init__.py +8 -0
- argenta-1.1.1/src/argenta/orchestrator/argparser/__init__.py +12 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/orchestrator/argparser/arguments/models.py +18 -12
- argenta-1.1.1/src/argenta/orchestrator/argparser/entity.py +39 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/orchestrator/entity.py +4 -7
- argenta-1.1.1/src/argenta/response/__init__.py +5 -0
- argenta-1.1.1/src/argenta/response/entity.py +23 -0
- argenta-1.1.1/src/argenta/response/status.py +19 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/router/__init__.py +2 -2
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/router/command_handler/entity.py +7 -27
- argenta-1.1.1/src/argenta/router/entity.py +212 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/router/exceptions.py +11 -8
- {argenta-1.0.7 → argenta-1.1.1}/tests/system_tests/test_system_handling_non_standard_behavior.py +51 -24
- {argenta-1.0.7 → argenta-1.1.1}/tests/system_tests/test_system_handling_normal_behavior.py +36 -26
- {argenta-1.0.7 → argenta-1.1.1}/tests/unit_tests/test_command.py +14 -13
- {argenta-1.0.7 → argenta-1.1.1}/tests/unit_tests/test_dividing_line.py +2 -2
- {argenta-1.0.7 → argenta-1.1.1}/tests/unit_tests/test_flag.py +25 -26
- argenta-1.1.1/tests/unit_tests/test_router.py +119 -0
- argenta-1.0.7/metrics_tests/get_time_of_pre_cycle_setup.py +0 -36
- argenta-1.0.7/mock/local_test.py +0 -18
- argenta-1.0.7/mock/mock_app/routers.py +0 -39
- argenta-1.0.7/src/argenta/app/__init__.py +0 -3
- argenta-1.0.7/src/argenta/app/registered_routers/entity.py +0 -34
- argenta-1.0.7/src/argenta/command/__init__.py +0 -3
- argenta-1.0.7/src/argenta/command/exceptions.py +0 -42
- argenta-1.0.7/src/argenta/command/flag/__init__.py +0 -17
- argenta-1.0.7/src/argenta/command/flag/defaults.py +0 -32
- argenta-1.0.7/src/argenta/command/flag/flags/__init__.py +0 -16
- argenta-1.0.7/src/argenta/command/flag/flags/models.py +0 -90
- argenta-1.0.7/src/argenta/command/flag/models.py +0 -134
- argenta-1.0.7/src/argenta/command/models.py +0 -195
- argenta-1.0.7/src/argenta/orchestrator/__init__.py +0 -4
- argenta-1.0.7/src/argenta/orchestrator/argparser/__init__.py +0 -4
- argenta-1.0.7/src/argenta/orchestrator/argparser/entity.py +0 -59
- argenta-1.0.7/src/argenta/response/__init__.py +0 -5
- argenta-1.0.7/src/argenta/response/entity.py +0 -29
- argenta-1.0.7/src/argenta/response/status.py +0 -8
- argenta-1.0.7/src/argenta/router/entity.py +0 -240
- argenta-1.0.7/tests/unit_tests/test_router.py +0 -124
- {argenta-1.0.7 → argenta-1.1.1}/LICENSE +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/imgs/argenta_banner.png +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/imgs/argenta_logo.png +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/imgs/argenta_logo_strip.png +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/imgs/argenta_logo_strip.svg +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/imgs/mock_app_preview1.png +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/imgs/mock_app_preview2.png +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/imgs/mock_app_preview3.png +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/imgs/mock_app_preview4.png +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/metrics_tests/__init__.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/mock/__init__.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/mock/mock_app/__init__.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/__init__.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/app/autocompleter/__init__.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/app/dividing_line/__init__.py +0 -0
- {argenta-1.0.7/src/argenta → argenta-1.1.1/src/argenta/app/registered_routers}/__init__.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/metrics/__init__.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/orchestrator/argparser/arguments/__init__.py +0 -0
- /argenta-1.0.7/src/argenta/app/registered_routers/__init__.py → /argenta-1.1.1/src/argenta/py.typed +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/router/command_handler/__init__.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/src/argenta/router/defaults.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/tests/__init__.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/tests/system_tests/__init__.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/tests/unit_tests/__init__.py +0 -0
- {argenta-1.0.7 → argenta-1.1.1}/tests/unit_tests/test_app.py +0 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
name: mypy
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ "main" ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ "main" ]
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
contents: read
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
build:
|
14
|
+
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
|
20
|
+
- uses: actions/setup-python@v3
|
21
|
+
with:
|
22
|
+
python-version: "3.13"
|
23
|
+
|
24
|
+
- name: Install dependencies
|
25
|
+
run: |
|
26
|
+
python -m pip install --upgrade pip
|
27
|
+
pip install mypy
|
28
|
+
pip install .
|
29
|
+
|
30
|
+
- name: Run type checker
|
31
|
+
run: mypy -p argenta
|
@@ -2,9 +2,9 @@ name: tests
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches: [ "
|
5
|
+
branches: [ "main" ]
|
6
6
|
pull_request:
|
7
|
-
branches: [ "
|
7
|
+
branches: [ "main" ]
|
8
8
|
|
9
9
|
permissions:
|
10
10
|
contents: read
|
@@ -24,8 +24,8 @@ jobs:
|
|
24
24
|
- name: Install dependencies
|
25
25
|
run: |
|
26
26
|
python -m pip install --upgrade pip
|
27
|
-
pip install
|
28
|
-
|
27
|
+
pip install uv
|
28
|
+
uv sync --group dev
|
29
29
|
|
30
30
|
- name: Run tests
|
31
|
-
run:
|
31
|
+
run: uv run python -m unittest discover
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: argenta
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.1.1
|
4
4
|
Summary: Python library for building modular CLI applications
|
5
5
|
Author-email: kolo <kolo.is.main@gmail.com>
|
6
6
|
License: MIT
|
7
7
|
License-File: LICENSE
|
8
|
-
Requires-Python: >=3.
|
8
|
+
Requires-Python: >=3.11
|
9
9
|
Requires-Dist: art<7.0,>=6.4
|
10
10
|
Requires-Dist: pyreadline3>=3.5.4
|
11
11
|
Requires-Dist: rich<15.0.0,>=14.0.0
|
@@ -15,9 +15,15 @@ Description-Content-Type: text/markdown
|
|
15
15
|
|
16
16
|
### Library for creating modular CLI applications
|
17
17
|
|
18
|
-
#### RU - [README.ru.md](https://github.com/koloideal/Argenta/blob/
|
18
|
+
#### RU - [README.ru.md](https://github.com/koloideal/Argenta/blob/main/README.ru.md) • DE - [README.de.md](https://github.com/koloideal/Argenta/blob/main/README.de.md)
|
19
19
|
|
20
|
-
|
20
|
+
---
|
21
|
+
|
22
|
+
Argenta allows you to encapsulate CLI functionality in isolated, abstracted environments. Eg: you are creating a utility similar to the Metasploit Framework, where the user first logs into a specific scope (for example, selects a module to scan), and then gets access to a set of commands specific only to that context. Argenta provides a simple and concise way to build such an architecture.
|
23
|
+
|
24
|
+
---
|
25
|
+
|
26
|
+

|
21
27
|
|
22
28
|
---
|
23
29
|
|
@@ -2,7 +2,11 @@
|
|
2
2
|
|
3
3
|
### Bibliothek zum Erstellen modularer CLI-Anwendungen
|
4
4
|
|
5
|
-
|
5
|
+
Mit Argenta können Sie die CLI-Funktionalität in isolierte, abstrahierte Umgebungen einkapseln. Zum Beispiel: Sie erstellen ein Dienstprogramm ähnlich dem Metasploit Framework, bei dem der Benutzer zuerst in einen bestimmten Scoop eintritt (z. B. ein Modul zum Scannen auswählt) und dann auf eine Reihe von Befehlen zugreift, die nur für diesen Kontext spezifisch sind. Argenta bietet eine einfache und prägnante Möglichkeit, eine solche Architektur zu konstruieren.
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+

|
6
10
|
|
7
11
|
---
|
8
12
|
|
@@ -2,9 +2,15 @@
|
|
2
2
|
|
3
3
|
### Library for creating modular CLI applications
|
4
4
|
|
5
|
-
#### RU - [README.ru.md](https://github.com/koloideal/Argenta/blob/
|
5
|
+
#### RU - [README.ru.md](https://github.com/koloideal/Argenta/blob/main/README.ru.md) • DE - [README.de.md](https://github.com/koloideal/Argenta/blob/main/README.de.md)
|
6
6
|
|
7
|
-
|
7
|
+
---
|
8
|
+
|
9
|
+
Argenta allows you to encapsulate CLI functionality in isolated, abstracted environments. Eg: you are creating a utility similar to the Metasploit Framework, where the user first logs into a specific scope (for example, selects a module to scan), and then gets access to a set of commands specific only to that context. Argenta provides a simple and concise way to build such an architecture.
|
10
|
+
|
11
|
+
---
|
12
|
+
|
13
|
+

|
8
14
|
|
9
15
|
---
|
10
16
|
|
@@ -2,7 +2,11 @@
|
|
2
2
|
|
3
3
|
### Библиотека для создания модульных CLI приложeний
|
4
4
|
|
5
|
-
|
5
|
+
Argenta позволяет инкапсулировать CLI фукциональность в изолированные, абстрагированные **среды**. К примеру: вы создаете утилиту, подобную Metasploit Framework, где пользователь сначала входит в определенный скоуп (например, выбирает модуль для сканирования), а затем получает доступ к набору команд, специфичных только для этого контекста. Argenta предоставляет простой и лаконичный способ для построения такой архитектуры.
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+

|
6
10
|
|
7
11
|
---
|
8
12
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
from argenta.command import Command
|
2
|
+
from argenta.metrics import get_time_of_pre_cycle_setup
|
3
|
+
from argenta.response import Response
|
4
|
+
from argenta.router import Router
|
5
|
+
from argenta.app import App
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
def commands_with_two_aliases(num_of_commands: int):
|
10
|
+
router = Router()
|
11
|
+
|
12
|
+
for i in range(num_of_commands):
|
13
|
+
@router.command(Command(f'cmd{i}', aliases=[f'cdr{i}', f'prt{i}']))
|
14
|
+
def handler(response: Response): # pyright: ignore[reportUnusedFunction, reportUnusedParameter]
|
15
|
+
pass
|
16
|
+
|
17
|
+
app = App()
|
18
|
+
app.include_router(router)
|
19
|
+
|
20
|
+
return get_time_of_pre_cycle_setup(app)
|
21
|
+
|
22
|
+
def commands_with_one_aliases(num_of_commands: int):
|
23
|
+
router = Router()
|
24
|
+
|
25
|
+
for i in range(num_of_commands):
|
26
|
+
@router.command(Command(f'cmd{i}', aliases=[f'cdr{i}']))
|
27
|
+
def handler(response: Response): # pyright: ignore[reportUnusedFunction, reportUnusedParameter]
|
28
|
+
pass
|
29
|
+
|
30
|
+
app = App()
|
31
|
+
app.include_router(router)
|
32
|
+
|
33
|
+
return get_time_of_pre_cycle_setup(app)
|
@@ -1,25 +1,22 @@
|
|
1
1
|
from mock.mock_app.routers import work_router
|
2
2
|
|
3
|
-
from argenta
|
4
|
-
from argenta.app
|
5
|
-
from argenta.
|
6
|
-
from argenta.
|
7
|
-
from argenta.orchestrator import Orchestrator
|
8
|
-
from argenta.orchestrator.argparser import ArgParser
|
9
|
-
from argenta.orchestrator.argparser.arguments import BooleanArgument
|
3
|
+
from argenta import App, Orchestrator
|
4
|
+
from argenta.app import PredefinedMessages, DynamicDividingLine, AutoCompleter
|
5
|
+
from argenta.orchestrator import ArgParser
|
6
|
+
from argenta.orchestrator.argparser import BooleanArgument
|
10
7
|
|
11
8
|
|
12
9
|
arg_parser = ArgParser(processed_args=[BooleanArgument("repeat")])
|
13
10
|
app: App = App(
|
14
11
|
dividing_line=DynamicDividingLine(),
|
15
12
|
autocompleter=AutoCompleter(),
|
16
|
-
repeat_command_groups=False,
|
17
13
|
)
|
18
14
|
orchestrator: Orchestrator = Orchestrator(arg_parser)
|
19
15
|
|
20
16
|
|
21
17
|
def main():
|
22
18
|
app.include_router(work_router)
|
19
|
+
print(f"\n\n{orchestrator.get_input_args()}")
|
23
20
|
|
24
21
|
app.add_message_on_startup(PredefinedMessages.USAGE)
|
25
22
|
app.add_message_on_startup(PredefinedMessages.AUTOCOMPLETE)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
from argenta.command import Command, PredefinedFlags, Flags, Flag, PossibleValues
|
2
|
+
from argenta.response import Response
|
3
|
+
from argenta import Router
|
4
|
+
|
5
|
+
|
6
|
+
work_router: Router = Router(title="Work points:")
|
7
|
+
|
8
|
+
flag = Flag('csdv', possible_values=PossibleValues.NEITHER)
|
9
|
+
|
10
|
+
|
11
|
+
@work_router.command(
|
12
|
+
Command("get",
|
13
|
+
description="Get Help",
|
14
|
+
aliases=["help", "Get_help"],
|
15
|
+
flags=Flags([PredefinedFlags.PORT,
|
16
|
+
PredefinedFlags.HOST])))
|
17
|
+
def command_help(response: Response):
|
18
|
+
print(response.status)
|
19
|
+
print(response.input_flags.flags)
|
20
|
+
|
21
|
+
|
22
|
+
@work_router.command("run")
|
23
|
+
def command_start_solving(response: Response):
|
24
|
+
print(response.status)
|
25
|
+
print(response.input_flags.flags)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
[project]
|
2
2
|
name = "argenta"
|
3
|
-
version = "1.
|
3
|
+
version = "1.1.1"
|
4
4
|
description = "Python library for building modular CLI applications"
|
5
5
|
authors = [{ name = "kolo", email = "kolo.is.main@gmail.com" }]
|
6
|
-
requires-python = ">=3.
|
6
|
+
requires-python = ">=3.11"
|
7
7
|
readme = "README.md"
|
8
8
|
license = { text = "MIT" }
|
9
9
|
dependencies = [
|
@@ -28,6 +28,9 @@ build-backend = "hatchling.build"
|
|
28
28
|
|
29
29
|
[dependency-groups]
|
30
30
|
dev = [
|
31
|
-
"
|
31
|
+
"mypy>=1.14.1",
|
32
|
+
"pytest>=8.3.2",
|
33
|
+
"ruff>=0.12.12",
|
34
|
+
"wemake-python-styleguide>=0.17.0",
|
32
35
|
]
|
33
36
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
__all__ = [
|
2
|
+
"App",
|
3
|
+
"PredefinedMessages",
|
4
|
+
"DynamicDividingLine",
|
5
|
+
"StaticDividingLine",
|
6
|
+
"AutoCompleter"
|
7
|
+
]
|
8
|
+
|
9
|
+
from argenta.app.models import App
|
10
|
+
from argenta.app.defaults import PredefinedMessages
|
11
|
+
from argenta.app.dividing_line.models import DynamicDividingLine, StaticDividingLine
|
12
|
+
from argenta.app.autocompleter.entity import AutoCompleter
|
@@ -13,10 +13,10 @@ class AutoCompleter:
|
|
13
13
|
:param autocomplete_button: the button for auto-completion
|
14
14
|
:return: None
|
15
15
|
"""
|
16
|
-
self.history_filename = history_filename
|
17
|
-
self.autocomplete_button = autocomplete_button
|
16
|
+
self.history_filename: str | None = history_filename
|
17
|
+
self.autocomplete_button: str = autocomplete_button
|
18
18
|
|
19
|
-
def _complete(self, text, state) -> str | None:
|
19
|
+
def _complete(self, text: str, state: int) -> str | None:
|
20
20
|
"""
|
21
21
|
Private. Auto-completion function
|
22
22
|
:param text: part of the command being entered
|
@@ -24,7 +24,7 @@ class AutoCompleter:
|
|
24
24
|
:return: the desired candidate as str or None
|
25
25
|
"""
|
26
26
|
matches: list[str] = sorted(
|
27
|
-
cmd for cmd in
|
27
|
+
cmd for cmd in _get_history_items() if cmd.startswith(text)
|
28
28
|
)
|
29
29
|
if len(matches) > 1:
|
30
30
|
common_prefix = matches[0]
|
@@ -38,7 +38,7 @@ class AutoCompleter:
|
|
38
38
|
i += 1
|
39
39
|
common_prefix = common_prefix[:i]
|
40
40
|
if state == 0:
|
41
|
-
readline.insert_text(common_prefix[len(text) :])
|
41
|
+
readline.insert_text(common_prefix[len(text) :])
|
42
42
|
readline.redisplay()
|
43
43
|
return None
|
44
44
|
elif len(matches) == 1:
|
@@ -54,10 +54,10 @@ class AutoCompleter:
|
|
54
54
|
"""
|
55
55
|
if self.history_filename:
|
56
56
|
if os.path.exists(self.history_filename):
|
57
|
-
readline.read_history_file(self.history_filename)
|
57
|
+
readline.read_history_file(self.history_filename)
|
58
58
|
else:
|
59
59
|
for line in all_commands:
|
60
|
-
readline.add_history(line)
|
60
|
+
readline.add_history(line)
|
61
61
|
|
62
62
|
readline.set_completer(self._complete)
|
63
63
|
readline.set_completer_delims(readline.get_completer_delims().replace(" ", ""))
|
@@ -69,7 +69,7 @@ class AutoCompleter:
|
|
69
69
|
:return: None
|
70
70
|
"""
|
71
71
|
if self.history_filename:
|
72
|
-
readline.write_history_file(self.history_filename)
|
72
|
+
readline.write_history_file(self.history_filename)
|
73
73
|
with open(self.history_filename, "r") as history_file:
|
74
74
|
raw_history = history_file.read()
|
75
75
|
pretty_history: list[str] = []
|
@@ -77,15 +77,14 @@ class AutoCompleter:
|
|
77
77
|
if line.split()[0] in all_commands:
|
78
78
|
pretty_history.append(line)
|
79
79
|
with open(self.history_filename, "w") as history_file:
|
80
|
-
history_file.write("\n".join(pretty_history))
|
80
|
+
_ = history_file.write("\n".join(pretty_history))
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
]
|
82
|
+
def _get_history_items() -> list[str] | list[Never]:
|
83
|
+
"""
|
84
|
+
Private. Returns a list of all commands entered by the user
|
85
|
+
:return: all commands entered by the user as list[str] | list[Never]
|
86
|
+
"""
|
87
|
+
return [
|
88
|
+
readline.get_history_item(i)
|
89
|
+
for i in range(1, readline.get_current_history_length() + 1)
|
90
|
+
]
|
@@ -5,7 +5,6 @@ class PredefinedMessages(StrEnum):
|
|
5
5
|
"""
|
6
6
|
Public. A dataclass with predetermined messages for quick use
|
7
7
|
"""
|
8
|
-
|
9
8
|
USAGE = "[b dim]Usage[/b dim]: [i]<command> <[green]flags[/green]>[/i]"
|
10
9
|
HELP = "[b dim]Help[/b dim]: [i]<command>[/i] [b red]--help[/b red]"
|
11
10
|
AUTOCOMPLETE = "[b dim]Autocomplete[/b dim]: [i]<part>[/i] [bold]<tab>"
|
@@ -8,7 +8,7 @@ class BaseDividingLine(ABC):
|
|
8
8
|
:param unit_part: the single part of the dividing line
|
9
9
|
:return: None
|
10
10
|
"""
|
11
|
-
self._unit_part = unit_part
|
11
|
+
self._unit_part: str = unit_part
|
12
12
|
|
13
13
|
def get_unit_part(self) -> str:
|
14
14
|
"""
|
@@ -22,7 +22,7 @@ class BaseDividingLine(ABC):
|
|
22
22
|
|
23
23
|
|
24
24
|
class StaticDividingLine(BaseDividingLine):
|
25
|
-
def __init__(self, unit_part: str = "-", length: int = 25) -> None:
|
25
|
+
def __init__(self, unit_part: str = "-", *, length: int = 25) -> None:
|
26
26
|
"""
|
27
27
|
Public. The static dividing line
|
28
28
|
:param unit_part: the single part of the dividing line
|
@@ -30,9 +30,9 @@ class StaticDividingLine(BaseDividingLine):
|
|
30
30
|
:return: None
|
31
31
|
"""
|
32
32
|
super().__init__(unit_part)
|
33
|
-
self.length = length
|
33
|
+
self.length: int = length
|
34
34
|
|
35
|
-
def get_full_static_line(self, is_override: bool) -> str:
|
35
|
+
def get_full_static_line(self, *, is_override: bool) -> str:
|
36
36
|
"""
|
37
37
|
Private. Returns the full line of the dividing line
|
38
38
|
:param is_override: has the default text layout been redefined
|
@@ -53,7 +53,7 @@ class DynamicDividingLine(BaseDividingLine):
|
|
53
53
|
"""
|
54
54
|
super().__init__(unit_part)
|
55
55
|
|
56
|
-
def get_full_dynamic_line(self, length: int, is_override: bool) -> str:
|
56
|
+
def get_full_dynamic_line(self, *, length: int, is_override: bool) -> str:
|
57
57
|
"""
|
58
58
|
Private. Returns the full line of the dividing line
|
59
59
|
:param length: the length of the dividing line
|