#!/usr/bin/env bash
#-------------------------------------------------------------------------------
# Copyright (C) 2012-2019 British Crown (Met Office) & Contributors.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Rose is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rose. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
# NAME
#     rosie lookup
#
# SYNOPSIS
#     rosie lookup [OPTIONS] LOOKUP-TEXT ...
#
# DESCRIPTION
#     Find suites in the suite discovery database.
#
#     Search for suites using an address, a query or search words and display
#     the information of the matching suites.
#
#     Unless an option is used to specify the initial search type the argument
#     is interpreted as follows:
#
#     * A string beginning with "http": an address
#     * A string not beginning with "http": search words
#
#     An address URL may contain shell meta characters, so remember to put it
#     in quotes.
#
#     The default output format includes a local working copy status field
#     (`%local`) in the first column.
#
#     * A blank field means there is no related suite checked out.
#     * `=` means that the suite is checked out at this branch and revision.
#     * `<` means that the suite is checked out but at an older revision.
#     * `>` means that the suite is checked out but at a newer revision.
#     * `S` means that the suite is checked out but on a different branch.
#     * `M` means that the suite is checked out and modified.
#     * `X` means that the suite is checked out but is corrupted.
#
#     Search strings may contain SQL wildcard characters. E.g:
#
#     * `%` (percent) is a substitute for zero or more characters.
#     * `_` (underscore) is a substitute for a single character.
#
# OPTIONS
#     --address-mode, --url, -A, -U
#         Shorthand for `--lookup-mode=address`.
#     --all-revs
#         Specify whether to search deleted suites and superceded suites.
#     --no-headers, -H
#         Do not print column headers.
#     --lookup-mode=MODE
#         Specify the initial lookup mode. `MODE` can be `address`, `query` or
#         `search`.
#     --prefix=PREFIX
#         Specify the name of a Rosie web service to use. This option can be
#         used multiple times.
#     --print-format=FORMAT, --format=FORMAT, -f FORMAT
#         Control the output format of the results using a string
#         containing column names or properties preceded by `%`.
#         For example: `rosie lookup daisy --format="%idx from %owner"`
#         might give: `abc01 from daisy`
#     --query, -Q
#         Shorthand for `--lookup-mode=query`.
#     --quiet, -q
#         Shorthand for `--format="%idx`.
#     --reverse, -r
#         Reverse sort order.
#     --search, -S
#         Shorthand for `--lookup-mode=search`.
#     --sort=FIELD, -s FIELD
#         Sort results by the field `FIELD` instead of revision.
#     --verbose, -v
#         Display full info for each returned suite.
#-------------------------------------------------------------------------------
exec python2 -m rosie.ws_client_cli lookup "$@"
