Skip to content

Commit 467be08

Browse files
rosie lookup: improve documentation
1 parent ea7a1b0 commit 467be08

1 file changed

Lines changed: 70 additions & 19 deletions

File tree

metomi/rosie/ws_client_cli.py

Lines changed: 70 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def list_local_suites():
183183
def lookup():
184184
"""CLI command to run the various search types"""
185185
opt_parser = RoseOptionParser(
186-
usage='rosie lookup [OPTIONS] LOOKUP-TEXT ...',
186+
usage='rosie lookup [OPTIONS] SEARCH-STRING ...',
187187
description='''
188188
Find suites in the suite discovery database.
189189
@@ -196,24 +196,75 @@ def lookup():
196196
* A string beginning with "http": an address
197197
* A string not beginning with "http": search words
198198
199-
An address URL may contain shell meta characters, so remember to put it
200-
in quotes.
201-
202-
The default output format includes a local working copy status field
203-
(`%local`) in the first column.
204-
205-
* A blank field means there is no related suite checked out.
206-
* `=` means that the suite is checked out at this branch and revision.
207-
* `<` means that the suite is checked out but at an older revision.
208-
* `>` means that the suite is checked out but at a newer revision.
209-
* `S` means that the suite is checked out but on a different branch.
210-
* `M` means that the suite is checked out and modified.
211-
* `X` means that the suite is checked out but is corrupted.
212-
213-
Search strings may contain SQL wildcard characters. E.g:
214-
215-
* `%` (percent) is a substitute for zero or more characters.
216-
* `_` (underscore) is a substitute for a single character.
199+
Search Strings:
200+
Search strings may contain SQL wildcard characters. E.g:
201+
202+
* `%` (percent) is a substitute for zero or more characters.
203+
* `_` (underscore) is a substitute for a single character.
204+
205+
Addresses:
206+
An address URL may contain shell meta characters, so remember to put it
207+
in quotes.
208+
209+
Output:
210+
The default output format includes a local working copy status field
211+
(`%local`) in the first column.
212+
213+
* A blank field means there is no related suite checked out.
214+
* `=` means that the suite is checked out at this branch and revision.
215+
* `<` means that the suite is checked out but at an older revision.
216+
* `>` means that the suite is checked out but at a newer revision.
217+
* `S` means that the suite is checked out but on a different branch.
218+
* `M` means that the suite is checked out and modified.
219+
* `X` means that the suite is checked out but is corrupted.
220+
221+
Queries:
222+
The SEARCH-STRING provides an easy way to search all fields.
223+
224+
Queries, supplied using the `-Q` argument allow for more targetted searching.
225+
The format is:
226+
227+
FIELD OPERATOR VALUE [CONJUNCTION FIELD OPERATOR VALUE ...]
228+
229+
FIELD:
230+
* access-list
231+
* author
232+
* branch
233+
* date
234+
* description
235+
* from_idx
236+
* idx
237+
* issue-list
238+
* owner
239+
* project
240+
* revision
241+
* status
242+
* suite
243+
* title
244+
245+
OPERATOR:
246+
* eq - equals
247+
* ne - not equal to
248+
* contains - the given string exists somewhere within this field
249+
* like - Similar to the SQL "like" operator, `_` matches one character,
250+
`%` matches one or more characters.
251+
252+
CONJUNCTION:
253+
Queries can be joined together using `and` or `or`, you may use parenthesis
254+
for logical grouping.
255+
256+
Examples:
257+
# list all suites with "expieriment" in any field
258+
$ rosie lookup experiment
259+
260+
# list all suites owned by "alice"
261+
$ rosie lookup -Q owner eq alice
262+
263+
# list all suites from the "u" repository that are owned by "alice"
264+
$ rosie lookup --prefix=u -Q owner eq alice
265+
266+
# list all suites in projects starting with "ocean" that are owned by "bob"
267+
$ rosie lookup -Q project like ocean% and owner eq bob
217268
''',
218269
).add_my_options(
219270
"address_mode",

0 commit comments

Comments
 (0)