Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望每个功能都能提供一个CLI接口 #34

Closed
CNSeniorious000 opened this issue May 19, 2022 · 1 comment
Closed

希望每个功能都能提供一个CLI接口 #34

CNSeniorious000 opened this issue May 19, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@CNSeniorious000
Copy link
Contributor

使用场景:在一个充满屏幕截图的文件夹下,用一行命令将这些截图转为ppt

建议:将命令命名为py-office或者poffice或者po,短命令好打

这样上述使用场景需要的命令大概是:

po img2ppt -i . -o output.pptx
# or:
python -m python-office img2ppt -i . -o output.pptx

要实现这个功能,需要:

  1. python-office的每个子包都有一个__main__.py文件
  2. 打包一个总的__main__.py为一个exe文件,比如命名为po.exe

建议:对CLI参数的解析可以借助标准库的argparse模块,

但个人更推荐使用第三方库typer,用装饰器的方式,更直观更便捷地将已有的功能函数转为cli接口


提供cli接口的一个用处是,让几乎完全没有python基础的人也能使用python-office

@CoderWanFeng
Copy link
Owner

非常好的建议,朋友能不能找个已有的功能,比如:tools.passwordtools
来按照你自己的想法,改写一下,提个pr出来,我们看看?

@CNSeniorious000 CNSeniorious000 added the enhancement New feature or request label May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants