Skip to content

Commit

Permalink
🎉 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed May 1, 2022
1 parent 04f9c67 commit 4a5c8e7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
11 changes: 2 additions & 9 deletions README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,13 @@ QQ Group: [Link](https://jq.qq.com/?_wv=1027&k=PUPOnCSH)

## Features

* 高效. 在 i5-10210U 处理器上, 性能大约为 `41000~101000 msg/s`; 测试脚本: [benchmark](dev_tools/benchmark.py)
* 精简、多样的构造方法
* 强大的自动类型转换功能
* 可传入同步与异步的 action 函数
* 高度自定义的 HelpFormat、Analyser
* 自定义语言文件, 间接支持 i18n
* Duplication、FuzzyMatch等一众特性

* High Performance. On i5-10210U, performance is about `41000~101000 msg/s`; test script: [benchmark](dev_tools/benchmark.py)
* Simple and Flexible Constructor
* Powerful Automatic Type Conversion
* Support Synchronous and Asynchronous Actions
* Customizable HelpFormatter and Analyser
* Customizable Language File, Directly Support i18n
* Customizable Language File, Support i18n
* Cache of input command for quick response of repeated command
* Various Features (Duplication, FuzzyMatch, etc.)

Example of Type Conversion:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ QQ 交流群: [链接](https://jq.qq.com/?_wv=1027&k=PUPOnCSH)
* 强大的自动类型转换功能
* 可传入同步与异步的 action 函数
* 高度自定义的 HelpFormat、Analyser
* 自定义语言文件, 间接支持 i18n
* 自定义语言文件, 支持 i18n
* 命令输入缓存, 以保证重复命令的快速响应
* Duplication、FuzzyMatch等一众特性

类型转换示范:
Expand Down
2 changes: 1 addition & 1 deletion arclet/alconna/builtin/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def body(self, parts: List[Dict[str, Any]]) -> str:
option_string = ""
options = []
opt_description = []
for opt in filter(lambda x: x['type'] == 'option', parts):
for opt in filter(lambda x: x['type'] == 'option' and x['name'] != "--shortcut", parts):
aliases = opt['additional_info'].get('aliases')
alias_text = ", ".join(aliases)
args = f"{self.parameters(opt['parameters'], opt['param_separator'])}"
Expand Down
2 changes: 1 addition & 1 deletion arclet/alconna/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self):
self.__commands = {}
self.__abandons = []
self.__shortcuts = LruCache()
self.__record = LruCache(20)
self.__record = LruCache(100)

def __del__(self): # td: save to file
self.__commands.clear()
Expand Down
14 changes: 14 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Alconna 0.9.x:

## Alconna 0.9.0:
1. 将 HelpAction 与 HelpTextFormatter 作为 help 模块
2. 语言配置组件的增强. 现在以语言种类标识符作为父级, 以支持多语言.
3. 为 manager 新增一个记录命令输入的 LruCache. 解析器可以使用这个缓存来避免重复解析. 目前缓存上限为 100.
4. 新增 `--shortcut` 内置选项, 为命令提供临时快捷命令的创建与删除.
5. 修改 manager 中的 `shortcut`, 并支持持久化
6. 部分性能优化, 以大致抵消因缓存计算而带来的性能损耗.
7. 部分 api 名称变更:
- `pattern` -> `pattern_gen`
- `handle_message` -> `process_message`
8. Args 新增 `add_argument` 方法, 以添加参数.

# Alconna 0.8.x:

## Alconna 0.8.0:
Expand Down

0 comments on commit 4a5c8e7

Please sign in to comment.