Mercurial Extension 没有/默认选项
假设我想要一个可以按如下方式执行的扩展: hg sayhi
我尝试了以下操作,但它告诉我存在无效参数:
def sayhi(ui, repo, node, **opts):
"""Says Hello"""
ui.write("hi")
cmdtable = {
"sayhi": (sayhi, [], '')
}
似乎无论我做什么,我都需要给它一个选项就像hg sayhi s
。 有办法做到这一点吗?
Say I want an extension that I can execute as follows: hg sayhi
I tried the following, but it tells me there are invalid arguments:
def sayhi(ui, repo, node, **opts):
"""Says Hello"""
ui.write("hi")
cmdtable = {
"sayhi": (sayhi, [], '')
}
It seems no matter what I do, I need to give it an option like hg sayhi s
.
Is there anyway to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,已修复。我从方法签名中删除了节点参数并且它起作用了。
Ok, got a fix. I removed the node parameter from the method signature and it works.