Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
a0d95f6d
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a0d95f6d
编写于
8月 11, 2020
作者:
B
Beraldo Leal
提交者:
GitHub
8月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4080 from beraldoleal/docs/settings-contributor
docs: small fixes on documentation
上级
43bca335
7e2a2528
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
9 deletion
+9
-9
docs/source/guides/contributor/chapters/plugins.rst
docs/source/guides/contributor/chapters/plugins.rst
+9
-9
未找到文件。
docs/source/guides/contributor/chapters/plugins.rst
浏览文件 @
a0d95f6d
...
...
@@ -35,9 +35,9 @@ It is usual for a plugin to allow users to do some degree of configuration
based on command-line options and/or configuration options. A plugin might
change its behavior depending on a specific configuration option.
Frequently, those
configurations come from configuration files and, sometimes,
from the command-line argument. Like in most UNIX-like tools, command-line
options
will override values defined inside the configuration files.
Frequently, those
settings come from configuration files and, sometimes, from
the command-line arguments. Like in most UNIX-like tools, command-line options
will override values defined inside the configuration files.
You, as a plugin writer, don’t need to handle this configuration by yourself.
Avocado provides a common API that can be used by plugins in order to register
...
...
@@ -53,9 +53,9 @@ option:
.. literalinclude:: ../../../../../examples/plugins/cli-cmd/hello_option/hello_option.py
This registration will register a “configuration namespace" (“hello.message”)
inside the configuration file
. A namespace is a “section” (“hello”) followed by
a “key” (“message”). In other words, the following entry in your configuration
file is valid and will be parsed::
inside the configuration file
only. A namespace is a “section” (“hello”)
followed by a “key” (“message”). In other words, the following entry in your
configuration
file is valid and will be parsed::
[hello]
message = My custom message
...
...
@@ -64,7 +64,7 @@ As you can see in the example above, you need to set a “default” value and t
value will be used if the option is not present in the configuration file. This
means that you can have a very small configuration file or even an empty one.
This is a very basic
us
e of how to configure options inside your plugin.
This is a very basic
exampl
e of how to configure options inside your plugin.
Adding command-line options
---------------------------
...
...
@@ -78,13 +78,13 @@ with your command-line option.
.. note:: Keep in mind that not all options should have a “command-line”
option. Try to keep the command-line as clean as possible. We use command-line
only for options that
need constantly
change and when editing the
only for options that
constantly need to
change and when editing the
configuration file is not handy.
For more information about how this registration process works, visit the
:meth:`.Settings.register_option()` method documentation.
Registering
P
lugins
Registering
p
lugins
===================
Avocado makes use of the `setuptools` and its `entry points` to register and
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录