-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
28 lines (20 loc) · 815 Bytes
/
Copy pathexample.py
File metadata and controls
28 lines (20 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from __future__ import annotations
from clilte import BasePlugin, CommandLine, PluginMetadata
from arclet.alconna import Alconna, Arparma, Args, CommandMeta, Option
class MyPlugin(BasePlugin):
def init(self) -> Alconna:
return Alconna(
"hello",
Args["name", str],
meta=CommandMeta("test command")
)
def meta(self) -> PluginMetadata:
return PluginMetadata("hello", "0.0.1", "my first plugin", ["dev"], ["john"])
def dispatch(self, result: Arparma, next_):
return next_(f"Hello! {result.name}")
if __name__ == '__main__':
cli = CommandLine(title="My first CLI", version="example 0.0.1", rich=True, fuzzy_match=True)
cli.add(MyPlugin)
cli.load_plugins("examples")
cli.load_register('builtin.cache')
cli.main()