click 版本升级7.0踩过的坑
click 版本升级7.0踩过哪些坑?
- click 版本6.7升级至7.0以上,包名由 click 变更为 Click
- click 的 Options 和 Parameters 规则变更为如下:
- For an option with ('-f', '--foo-bar'), the parameter name is foo_bar.
- For an option with ('-x',), the parameter is x.
- For an option with ('-f', '--filename', 'dest'), the parameter name is dest.
- For an option with ('--CamelCaseOption',), the parameter is camelcaseoption.
- For an arguments with (
foogle), the parameter name is foogle. To provide a different human readable name for use in help text, see the section about Truncating Help Texts.
click 版本升级7.0及以上,当 option 为 '--foo_far' 时,命令行运行会把参数变更为 '--foo-bar',即 '—' 变 '-'。
click 版本升级后示例
# test.py 脚本命令如下:
@click.command()
@click.option('-lld', '--last-login-days', default=30, help='Days from user\'s last login day.')
@click.option('-gd', '--gap-days', default=3, help='Days between 2 wake-up user.')
@click.option('-env', default='test', help='test or production')
def get_something(last_login_days, gap_days, kill_days, env):
print("last_login_days:{}".format(last_login_days))
print("gap_days:{}".format(gap_days))
print("env:{}".format(env))
if__name__ == '__main__':
get_something()
# 执行脚本语句如下:
python test.py -lld 100 -gd 30 -env test
# Output:
# last_login_days:100
# gap_days:10
# kill_days:15
# env:test
参考资料:
- https://click.palletsprojects.com/en/7.x/options/
- https://click.palletsprojects.com/en/7.x/parameters/#parameter-names
click 版本升级7.0踩过的坑的更多相关文章
- 【C#】调用2.0踩过的坑
1.初始化[DllImport(“libarcsoft_face_engine.dll”, EntryPoint = “ASFInitEngine”, CallingConvention = Call ...
- manjaro xfce 18.0 踩坑记录
manjaro xfce 18.0 踩坑记录 1 简介1.1 Manjaro Linux1.2 开发桌面环境2 自动打开 NumLock3 系统快照3.1 安装timeshift3.2 使用times ...
- Win10 安装配置 MongoDB 4.0 踩坑记
redis 官方没有 Windows 版的,微软维护的已经好久没更新了,所以就在想着换成 MongoDB. 于是一趟被我复杂化的踩坑之旅就开始了,同时也记录一下,避免有人遇见跟我一样的问题. 首先在 ...
- web开发实战--弹出式富文本编辑器的实现思路和踩过的坑
前言: 和弟弟合作, 一起整了个智慧屋的小web站点, 里面包含了很多经典的智力和推理题. 其实该站点从技术层面来分析的话, 也算一个信息发布站点. 因此在该网站的后台运营中, 富文本的编辑器显得尤为 ...
- 第八篇:web之前端踩的一些坑
前端踩的一些坑 前端踩的一些坑 本节内容 事件代理 清除标签的所有事件 bootstrap的模态框自定义方法 ajax在django里面实现post提交 ajax提交数据嵌套 1.事件代理 之前写 ...
- elasticsearch2.3.3集群搭建踩到的坑
本文来自我的github pages博客http://galengao.github.io/ 即www.gaohuirong.cn 摘要: 作者原来搭建的环境是0.95版本 现在升级到2.3.3版本, ...
- 那些移动端web踩过的坑
原文链接:https://geniuspeng.github.io/2017/08/24/mobile-issues/ 扔了N久,还是捡回来了.好好弄一下吧.刚工作的时候挺忙的,后来不那么忙了,但是变 ...
- 【转载】Fragment 全解析(1):那些年踩过的坑
http://www.jianshu.com/p/d9143a92ad94 Fragment系列文章:1.Fragment全解析系列(一):那些年踩过的坑2.Fragment全解析系列(二):正确的使 ...
- 《C++之那些年踩过的坑(三)》
C++之那些年踩过的坑(三) 作者:刘俊延(Alinshans) 本系列文章针对我在写C++代码的过程中,尤其是做自己的项目时,踩过的各种坑.以此作为给自己的警惕. [版权声明]转载请注明原文来自:h ...
随机推荐
- adf常用方法总结
1.使用clientAttribute传值.获取值 或组件上面放客户端属性 <af:selectBooleanCheckbox text="" label="&qu ...
- ueditor使用注意
问题1:后端配置项没有正常加载,上传插件不能正常使用! 我用的是开发版,1.4.3.3 .Net版 网上查了很多,后来发现只是配置的问题而已. 1.在根目录下:config.json 其中有Img上传 ...
- 移动端bug之解决方式
1.Android中元素被点击时产生的边框: * { -webkit-tap-highlight-color: rgba(250,250,250,0); /*更改点击事件的焦点色*/} 2.去除移 ...
- Rakefile实例教程
一.简介 简单的说Rakefile就是使用Ruby语法的makefile, 对应make的工具就是rake. 在Ruby on Rails里面, 不管是数据库的初始化, 内容初始化, 删除, 还是测试 ...
- laravel配置路由出现404
nginx配置上加一句话 location / { #try_files $uri $uri/ =; try_files $uri $uri/ /index.php?$query_string; }
- java.text.SimpleDateFormat的使用
SimpleDateFormat 是一个以国别敏感的方式格式化和分析数据的具体类. 它允许格式化 (date -> text).语法分析 (text -> date)和标准化. Simpl ...
- stl学习记录(2)
#include <iostream> #include <utility> #include <tuple> #include <complex> # ...
- 库函数方式文件编程----fopen
使用fopen等文件访问库函数编写应用程序,该应用程序实现文件的复制功能. 1.打开文件---fopen 函数功能:打开文件 头文件:#include<stdio.h> 函数原型:FILE ...
- 2018.10.18 poj2187Beauty Contest(旋转卡壳)
传送门 旋转卡壳板子题. 就是求凸包上最远点对. 直接上双指针维护旋转卡壳就行了. 注意要时刻更新最大值. 代码: #include<iostream> #include<cstdi ...
- 30. Child Labor Problem and Its Solution 童工问题及解决方法
30. Child Labor Problem and Its Solution 童工问题及解决方法 ① Over a hundred years ago,Charles Dickens shocke ...