Is there a way to only show base "--help" for explicitly defined options?
还没有人认领这个 Issue。
评估
调研方向
从 traitlets.config.application.Application 开始,跟踪 --help 的输出是如何由别名和内置选项组装而成的。根据示例确认预期行为:--help 应只显示显式定义的选项,例如 --github-token,而 --help-all 仍可用于完整的选项集合。
由索引模型根据 Issue 内容生成。
描述
When creating the aliases, flags, etc for the options, is there a way to only show those options that I've explicitly defined?
For example, consider this code:
from traitlets import Unicode
from traitlets.config import SingletonConfigurable
from traitlets.config.application import Application
class ConfigStore(SingletonConfigurable):
github_token = Unicode("", help="Your Github access token").tag(config=True)
class AppController(Application):
classes = [ConfigStore]
aliases = {
("github-token"): (
"ConfigStore.github_token",
"your github access token, usually set via environment variable GITHUB_TOKEN",
),
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if __name__ == "__main__":
app = AppController()
app.launch_instance()
When called with --help it outputs the following:
This is an application.
Options
=======
The options below are convenience aliases to configurable class-options,
as listed in the "Equivalent to" description-line of the aliases.
To see all configurable class-options for some <cmd>, use:
<cmd> --help-all
--debug
Set log-level to debug, for the most verbose logging.
Equivalent to: [--Application.log_level=10]
--show-config
Show the application's configuration (human-readable format)
Equivalent to: [--Application.show_config=True]
--show-config-json
Show the application's configuration (json format)
Equivalent to: [--Application.show_config_json=True]
--github-token=<Unicode>
your github access token, usually set via environment variable GITHUB_TOKEN
Default: ''
Equivalent to: [--ConfigStore.github_token]
To see all available configurables, use `--help-all`.
Is there a way to configure the Application such that it only displays this:
--github-token=<Unicode>
your github access token, usually set via environment variable GITHUB_TOKEN
Default: ''
Sorry to ask a question in a github issue. Is there a better forum to ask these sorts of questions? Thank you!!
- 主要语言
- Python
- 星标
- 653
- 派生
- 217
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ipython/traitlets 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 65/100
-
难度 1/5 1-3 小时 新手友好度 65/100
-
good first issue
难度 1/5 1 小时以内 新手友好度 85/100
-
documentation
难度 1/5 1 小时以内 新手友好度 65/100
-
难度 3/5 1-2 天 新手友好度 45/100
查看 ipython/traitlets 的全部 Issue
相似的 Issue
-
agent-ready documentation needs-triage
难度 1/5 1-3 小时 新手友好度 88/100
-
documentation
难度 1/5 1 小时以内 新手友好度 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
-
instance instance add
难度 1/5 1 小时以内 新手友好度 72/100
searxng/searx-instances#939 · 1 条评论 ·
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100