comparison sat_frontends/jp/cmd_pubsub.py @ 2764:92af49cde255

jp (base): MAM and RSM arguments can now be used for pubsub commands: - RSM and MAM args arguments have been added to pubsub group, and activated when multiple items are possible - /!\ --max-items (i.e. pubsub original max) short option has been change for -M, and -m is now used for RSM max - pubsub/search -m option has been renamed -M for same reason as above - pubsub/search -o option has been replaced by -k (for keep), to avoid conflict with order-by (and long version is now --node-max)
author Goffi <goffi@goffi.org>
date Fri, 11 Jan 2019 10:18:02 +0100
parents 4b693ea24d5f
children 003b8b4b56a7
comparison
equal deleted inserted replaced
2763:c4190d5340ab 2764:92af49cde255
1019 errback=self.psAffiliationsGetEb, 1019 errback=self.psAffiliationsGetEb,
1020 ) 1020 )
1021 1021
1022 1022
1023 class Search(base.CommandBase): 1023 class Search(base.CommandBase):
1024 """this command to a search without using MAM, i.e. by checking every items if dound by itself, so it may be heavy in resources both for server and client""" 1024 """this command do a search without using MAM
1025
1026 This commands checks every items it finds by itself,
1027 so it may be heavy in resources both for server and client
1028 """
1025 1029
1026 RE_FLAGS = re.MULTILINE | re.UNICODE 1030 RE_FLAGS = re.MULTILINE | re.UNICODE
1027 EXEC_ACTIONS = (u"exec", u"external") 1031 EXEC_ACTIONS = (u"exec", u"external")
1028 1032
1029 def __init__(self, host): 1033 def __init__(self, host):
1034 # FIXME: C.NO_MAX is not needed here, and this can be globally removed from consts
1035 # the only interest is to change the help string, but this can be explained
1036 # extensively in man pages (max is for each node found)
1030 base.CommandBase.__init__( 1037 base.CommandBase.__init__(
1031 self, 1038 self,
1032 host, 1039 host,
1033 "search", 1040 "search",
1034 use_output=C.OUTPUT_XML, 1041 use_output=C.OUTPUT_XML,
1065 help=_( 1072 help=_(
1066 u"maximum depth of recursion (will search linked nodes if > 0, default: 0)" 1073 u"maximum depth of recursion (will search linked nodes if > 0, default: 0)"
1067 ), 1074 ),
1068 ) 1075 )
1069 self.parser.add_argument( 1076 self.parser.add_argument(
1070 "-m", 1077 "-M",
1071 "--max", 1078 "--node-max",
1072 type=int, 1079 type=int,
1073 default=30, 1080 default=30,
1074 help=_( 1081 help=_(u"maximum number of items to get per node ({} to get all items, "
1075 u"maximum number of items to get per node ({} to get all items, default: 30)".format( 1082 u"default: 30)".format( C.NO_LIMIT)),
1076 C.NO_LIMIT
1077 )
1078 ),
1079 ) 1083 )
1080 self.parser.add_argument( 1084 self.parser.add_argument(
1081 "-N", 1085 "-N",
1082 "--namespace", 1086 "--namespace",
1083 action="append", 1087 action="append",
1176 nargs="?", 1180 nargs="?",
1177 metavar="BOOLEAN", 1181 metavar="BOOLEAN",
1178 help=_(u"(don't) use DOTALL option for regex (default: don't use)"), 1182 help=_(u"(don't) use DOTALL option for regex (default: don't use)"),
1179 ) 1183 )
1180 flags.add_argument( 1184 flags.add_argument(
1181 "-o", 1185 "-k",
1182 "--only-matching", 1186 "--only-matching",
1183 action="append", 1187 action="append",
1184 dest="filters", 1188 dest="filters",
1185 type=flag_matching, 1189 type=flag_matching,
1186 const=("only-matching", True), 1190 const=("only-matching", True),