jp: pubsub options refactoring:
There is now only "use_pubsub", and specification are set using "pubsub_flags" argument when instantiating CommandBase. Options are more Python Zen compliant by using explicit arguments for item, draft, url instead of trying to guess with magic keyword and type detection. Pubsub node and item are now always using respecively "-n" and "-i" even when required, this way shell history can be used to change command more easily, and it's globally less confusing for user. if --pubsub-url is used, elements can be overwritten with individual option (e.g. change item id with --item). New "use_draft" argument in CommandBase, to re-use current draft or open a file path as draft. Item can now be specified when using a draft. If it already exists, its content will be added to current draft (with a separator), to avoid loosing data. common.BaseEdit.getItemPath could be simplified thanks to those changes. Pubsub URI handling has been moved to base.py.
This commit is contained in:
parent
03e9e2b281
commit
6f8834f9da
1 changed files with 268 additions and 296 deletions
|
|
@ -35,12 +35,11 @@ class Edit(base.CommandBase, common.BaseEdit):
|
|||
use_items=False
|
||||
|
||||
def __init__(self, host):
|
||||
base.CommandBase.__init__(self, host, 'edit', use_pubsub=True, use_verbose=True, help=_(u'edit forums'))
|
||||
base.CommandBase.__init__(self, host, 'edit', use_pubsub=True, use_draft=True, use_verbose=True, help=_(u'edit forums'))
|
||||
common.BaseEdit.__init__(self, self.host, FORUMS_TMP_DIR)
|
||||
self.need_loop=True
|
||||
|
||||
def add_parser_options(self):
|
||||
common.BaseEdit.add_parser_options(self)
|
||||
self.parser.add_argument("-k", "--key", type=base.unicode_decoder, default=u'',
|
||||
help=_(u"forum key (DEFAULT: default forums)"))
|
||||
|
||||
|
|
@ -84,7 +83,6 @@ class Edit(base.CommandBase, common.BaseEdit):
|
|||
exit_code=C.EXIT_BRIDGE_ERRBACK)
|
||||
|
||||
def start(self):
|
||||
common.checkURI(self.args)
|
||||
self.host.bridge.forumsGet(
|
||||
self.args.service,
|
||||
self.args.node,
|
||||
|
|
@ -146,7 +144,6 @@ class Get(base.CommandBase):
|
|||
self.host.quit()
|
||||
|
||||
def start(self):
|
||||
common.checkURI(self.args)
|
||||
self.host.bridge.forumsGet(
|
||||
self.args.service,
|
||||
self.args.node,
|
||||
|
|
|
|||
Loading…
Reference in a new issue