Skip to content

Commit aa22aac

Browse files
committed
Added service list to commandline tool.
1 parent e9344da commit aa22aac

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

README.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ service as its first argument followed by the service's parameters.
150150
The results of the service call are printed in separate lines with the fields
151151
separated by commas (use ``--delimiter`` to modify that behaviour, it
152152
understands patterns such as ``\t`` for TAB). Use ``--schema`` to obtain the
153-
service's result columns.
153+
service's result columns, or, if no service is supplied, a list of services.
154154

155155
You can supply your credentials via ``--user`` and ``--password`` for
156156
authenticated access.
@@ -162,6 +162,9 @@ program will terminate with exit code 1. If the remote server reported failure
162162
Changelog
163163
---------
164164

165+
1.3.1
166+
* Added service listing to ``wortschatz`` script.
167+
165168
1.3
166169
* Added commandline script ``wortschatz`` for ad-hoc access.
167170
* Jumped to setuptools.

gendocs

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ TEMPLATE = """
2222
"""
2323
2424
for name, service in services.iteritems():
25-
label = "%s(%s)" % (name, ", ".join(service._args))
26-
print TEMPLATE % dict(label=label, underline="^" * len(label), name=name,
27-
returns=", ".join(service._returns),
25+
label = service._label
26+
print TEMPLATE % dict(label=label,
27+
underline="^" * len(label),
28+
name=name,
29+
returns=func._retlabel,
2830
doc=dedent(service._doc))
2931
EOF

libleipzig/main.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
from libleipzig import WebFault
33
import optparse
44

5-
parser = optparse.OptionParser()
5+
parser = optparse.OptionParser(
6+
epilog = "Services: %s" % ("; ".join(service._label for service
7+
in services.itervalues()))
8+
)
69
parser.add_option("-s", "--schema", action='store_true',
710
help="show service's output schema and exit")
811
parser.add_option("-d", "--delimiter", metavar="DELIM", default=",",

libleipzig/transport.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ def func(*vectors, **options):
7575
func._doc = func.__doc__ or ''
7676
func._args = args
7777
func._returns = results
78-
func.__doc__ = "%s(%s) -> %s\n" % (name, ", ".join(args),
79-
", ".join(results)) + func._doc
78+
func._label = label = "%s(%s)" % (name, ", ".join(args))
79+
func._retlabel = retlabel = ", ".join(results)
80+
func.__doc__ = "%s -> %s\n" % (label, retlabel) + func._doc
8081
func.prefetch = lambda: get_client(func, name)
8182
func.set_credentials = lambda username, password: (
8283
get_client(func, name).set_options(

0 commit comments

Comments
 (0)