Comments (9)
提议3加强:
所有的选项前缀都加在key值的尾部, 并
尝试以单个字母代替特殊符号
如
Args["foo#3":str]
Args["bar#M":int] # * -> M
Args["baz#K":str] # @ -> K
Args["qux#O":bool] # ? -> O
#
可能会用%
或者[]
代替
from alconna.
- 增加ArgsSep
Args增加separator参数,以细分参数分割。
传入方式如下:
Option("foo", Args[...].separate("*"), separator=";")
Option("foo", Args[...] / "*", separator=";")
此时应如下传入参数:
>>> foo;bar*baz*qux
from alconna.
- AlconnaGroup
AlcGp是作为多级结构的替代实现(即解禁subcmd禁止嵌套后的效果)
AlcGp拥有一个标识符,作为对其下命令集的等效父级命令地址
一个命令只能加入一个命令组内,并且加入时其所在命名空间自动替换为其命令组所在命名空间
AlcGp允许嵌套
from alconna.
- 改进Alconna.command的正则
应把AlcFormat中的样子拿过来,
即由原先的
Alconna(f"{AnyStr}天气")
变为
Alconna("{city:str}天气") # str可以忽略
规则如下:
以":"为分隔,左边为位名称,右边为位类型
位名称可以忽略, 但不会将匹配结果传入Arpamar; 此时"{}"与"{:}"与"{:str}"等价
位类型也可忽略,此时默认为"str"
from alconna.
- 选项的空分隔符支持
即Option(..., separator="")
此时可以搭配Args.sep实现如下效果:
opt = Option("从", Args["tag;S":str] / "和", separator="")
...
>>> analyse_option(opt, "从纯爱和女仆")
{"从": {"tag": ("纯爱", "女仆")}}
from alconna.
- 多separator多支持
即传入separator时可以接受Collection[str]
如
arg = Args["tag;S":str].separate("和", "与", ",")
...
>>> analyse_args(arg, "女仆,双人和百合与纯爱")
{"tag": ("女仆", "双人", "百合", "纯爱")}
from alconna.
- ArgPatternContext
对于每一个 Alconna 指令,其默认调用全局的ArgPatternContext,并允许用户传入自定义的Context。
Context会将pattern_map,argument_validator与set_converter集成为一个类。
from alconna.
- ArgPatternContext
对于每一个 Alconna 指令,其默认调用全局的ArgPatternContext,并允许用户传入自定义的Context。
Context会将pattern_map,argument_validator与set_converter集成为一个类。
驳回
from alconna.
移步给讨论区
from alconna.
Related Issues (20)
- [Feature]Option Behavior
- [Feature]Enhance Arpamar
- [Feature]Enhance ArgPattern
- [Feature] 明确测试脚本 HOT 1
- [Bug] 开启报错后 GraiaDispatcher 报"非法元素" HOT 1
- [Feature] ActionBehavior HOT 1
- [Feature] Arpamar 改进 HOT 1
- [Feature] 异步支持
- [Feature] 命令组
- [Feature] PatternValidator
- [Feature] ArgsField
- [Feature] 主动隐藏命令
- [Feature] Raw-All-Command-Help
- [Feature] 半自动补全
- [Feature] 1.4 TODO
- [Feature] v2 design HOT 8
- [Feature] 💡dump Alconna to json and generate Alconna from json HOT 2
- [Bug] 改进 `-h` HOT 5
- [OSPP] Alconna 2.0 版本设计与开发 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alconna.