1#!/usr/bin/env python3
2"""
3
4"""
5# ruff: noqa: F401
6# Imports:
7from __future__ import annotations
8
9# ##-- 3rd party imports
10from jgdv import Proto, Maybe
11
12# ##-- end 3rd party imports
13
14# ##-- 1st party imports
15
16# ##-- end 1st party imports
17
18# ##-- types
19# isort: off
20import abc
21from abc import abstractmethod
22import collections.abc
23from typing import TYPE_CHECKING, cast, assert_type, assert_never
24from typing import Generic, NewType
25# Protocols:
26from typing import Protocol, runtime_checkable
27# Typing Decorators:
28from typing import no_type_check, final, override, overload
29
30if TYPE_CHECKING:
31 from jgdv import VerStr
32 from jgdv import Maybe
33 from typing import Final
34 from typing import ClassVar, Any, LiteralString
35 from typing import Never, Self, Literal
36 from typing import TypeGuard
37 from collections.abc import Iterable, Iterator, Callable, Generator
38 from collections.abc import Sequence, Mapping, MutableMapping, Hashable
39 from jgdv.structs.chainguard import ChainGuard
40
41##--|
42from jgdv.cli._interface import CLIParamProvider_p
43# isort: on
44# ##-- end types
45
[docs]
46@runtime_checkable
47class AcceptsSubcmds_p(Protocol):
48 """ Protocol for marking cmds as able to allow subcmds in cli parsing """
49
[docs]
50 def _accept_subcmds(self) -> Literal[True]: ...
51
[docs]
52@runtime_checkable
53class Command_p(CLIParamProvider_p, Protocol):
54 """
55 Holds command information and performs it
56 """
57
[docs]
58 @property
59 def name(self) -> str: ...
[docs]
60 @property
61 def help(self) -> list[str]: ...
[docs]
62 @property
63 def helpline(self) -> str: ...
64 ##--|
65 def __call__(self, *, idx:int, tasks:ChainGuard, plugins:ChainGuard):
66 pass
67
[docs]
68 def shutdown(self, tasks:ChainGuard, plugins:ChainGuard, errored:Maybe[Exception]=None) -> None:
69 """
70 A Handler called on doot shutting down. only the triggered cmd's shutdown gets called
71 """
72 pass