问题描述
我正在编写一个带有 Twisted 的服务器,它基于启动服务和应用程序的 *.tac 文件.我想获得一个额外的命令行参数来指定一个 yaml 配置文件.我已经尝试通过构建一个继承自它的类来使用 usage.Options,但由于在我的类 Options(...) 类中没有指定额外的、扭曲的命令行参数(例如 -y)而令人窒息.
I'm writing a server with Twisted that is based on a *.tac file that starts the services and the application. I'd like to get one additional command line argument to specify a yaml configuration file. I've tried using usage.Options by building a class that inherits from it, but is choking because of the additional, twistd command line arguments (-y for example) not being specified in my class Options(...) class.
如何获得一个额外的参数并仍然将其余的参数传递给twisted?我是否必须使用插件系统来执行此操作?
How can get one additional argument and still pass the rest to twistd? Do I have to do this using the plugin system?
预先感谢您的帮助!
道格
推荐答案
一个 tac 文件 是 配置.它不接受配置.
A tac file is configuration. It doesn't accept configuration.
如果你想传递命令行参数,你需要编写一个插件.
If you want to pass command line arguments, you do need to write a plugin.
这篇关于在 *.tac 文件中使用 usage.options 扭曲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!