https://github.com/arcletproject/alconna-notation
serializer & deserializer of Alconna
https://github.com/arcletproject/alconna-notation
Last synced: about 1 month ago
JSON representation
serializer & deserializer of Alconna
- Host: GitHub
- URL: https://github.com/arcletproject/alconna-notation
- Owner: ArcletProject
- Created: 2023-05-28T15:26:59.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-28T15:28:14.000Z (about 3 years ago)
- Last Synced: 2025-03-01T20:45:54.248Z (over 1 year ago)
- Language: Python
- Size: 14.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Alconna Notation
以 [`HOCON`](https://github.com/chimpler/pyhocon) 为基础的序列化/反序列化工具,用于转换 `Alconna`。
## 示例
```python
import arclet.alconna.notation as alcon
# 从字符串解析
alc = alcon.loads(
"""\
command = test
args {
foo = str
bar = int
}
options = [
{
name = --spam
aliases = [-s]
default = true
action = store_false
}
{
name = --eggs
aliases = [-e]
args {
count = int
}
default = 0
}
]
"""
)
assert alc.parse("test abc 123 -s").query("foo") == "abc"
```