Commits

Andy Mikhailenko committed c69d363

Improved documentation.

Comments (0)

Files changed (2)

 * infer command name from function name;
 * add an alias root command ``help`` for the ``--help`` argument;
 * enable passing unwrapped arguments to certain functions instead of a
-  :class:`argparse.Namespace` object.
+  `argparse.Namespace` object.
 
 `Argh` is fully compatible with `argparse`. You can mix `argh`-agnostic and
-`argh`-aware code. Just keep in mind that :func:`argh.dispatch` does some extra
+`argh`-aware code. Just keep in mind that `argh.dispatch` does some extra
 work that a custom dispatcher may not do.
 
 Installation
 
 Originally written by Andrey Mikhaylenko in 2010.
 
-See :file:`AUTHORS` for a complete authors list of this application.
+See file `AUTHORS` for a complete authors list of this application.
 
 Please feel free to submit patches, report bugs or request features:
 

docs/tutorial.rst

         parser.dispatch()
 
 The example above defines four commands: `shell`, `load`, `serve` and `serve-rest`.
-Note how they are assembled together in the last :func:`make_parser` call: two
-commands as arguments and two as a keyword argument `web`. This is the
-resulting command-line interface:
+Note how they are assembled together by :meth:`argh.ArghParser.add_commands`:
+two at root level and two within a namespace "www". This is the resulting
+command-line interface:
 
     * ``./prog.py shell``
     * ``./prog.py load prancing_ponies.json``
     parser.dispatch()
 
 It produces a command hierarchy for the command-line expressions ``foo bar``
-and ``foo quux``. It is roughly equivalent to this generic argparse code::
+and ``foo quux``. It is equivalent to this generic argparse code::
 
     import sys
-    from argparse import ArgumentParser
+    import argparse
 
     p = argparse.ArgumentParser()
     subparsers = p.add_subparsers()
+
     foo_parser = subparsers.add_parser('foo')
     foo_subparsers = foo_parser.add_subparsers()
+
     foo_bar_parser = foo_subparsers.add_parser('bar')
     foo_bar_parser.set_defaults(function=bar)
+
+    foo_quux_parser = foo_subparsers.add_parser('quux')
+    foo_quux_parser.set_defaults(function=quux)
+
     args = p.parse_args(sys.argv[1:])
     print args.function(args)
 
 
 .. note::
 
-    You don't have to use :class:`ArghParser`; the standard
+    You don't have to use :class:`argh.ArghParser`; the standard
     :class:`argparse.ArgumentParser` will do. You will just need to call
-    stand-alone functions :func:`add_commands` and :func:`dispatch` instead of
-    :class:`ArghParser` methods.
-
+    stand-alone functions :func:`argh.add_commands` and :func:`argh.dispatch`
+    instead of :class:`argh.ArghParser` methods.