jp (base): add flag for use_pubsub to add cache skipping option
This commit is contained in:
parent
aab8a38836
commit
d10ce3ad7a
1 changed files with 22 additions and 5 deletions
|
|
@ -34,6 +34,7 @@ import tty
|
|||
import termios
|
||||
from pathlib import Path
|
||||
from glob import iglob
|
||||
from typing import Optional
|
||||
from importlib import import_module
|
||||
from sat_frontends.tools.jid import JID
|
||||
from sat.tools import config
|
||||
|
|
@ -332,7 +333,7 @@ class LiberviaCli:
|
|||
|
||||
|
||||
def make_pubsub_group(self, flags, defaults):
|
||||
"""generate pubsub options according to flags
|
||||
"""Generate pubsub options according to flags
|
||||
|
||||
@param flags(iterable[unicode]): see [CommandBase.__init__]
|
||||
@param defaults(dict[unicode, unicode]): help text for default value
|
||||
|
|
@ -402,7 +403,7 @@ class LiberviaCli:
|
|||
help=_("find page before this item"), metavar='ITEM_ID')
|
||||
rsm_page_group.add_argument(
|
||||
"--index", dest="rsm_index", type=int,
|
||||
help=_("index of the page to retrieve"))
|
||||
help=_("index of the first item to retrieve"))
|
||||
|
||||
|
||||
# MAM
|
||||
|
|
@ -424,6 +425,12 @@ class LiberviaCli:
|
|||
C.ORDER_BY_MODIFICATION],
|
||||
help=_("how items should be ordered"))
|
||||
|
||||
if flags[C.CACHE]:
|
||||
pubsub_group.add_argument(
|
||||
"-C", "--no-cache", dest="use_cache", action='store_false',
|
||||
help=_("don't use Pubsub cache")
|
||||
)
|
||||
|
||||
if not flags.all_used:
|
||||
raise exceptions.InternalError('unknown flags: {flags}'.format(
|
||||
flags=', '.join(flags.unused)))
|
||||
|
|
@ -1235,6 +1242,16 @@ class CommandBase(object):
|
|||
else:
|
||||
if order_by is not None:
|
||||
extra[C.KEY_ORDER_BY] = self.args.order_by
|
||||
|
||||
# Cache
|
||||
try:
|
||||
use_cache = self.args.use_cache
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
if not use_cache:
|
||||
extra[C.KEY_USE_CACHE] = use_cache
|
||||
|
||||
return data_format.serialise(extra)
|
||||
|
||||
def add_parser_options(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue