1. okfn
  2. ordf


William Waites  committed 0fcb167

Documentation patch

  • Participants
  • Parent commits ef8422f
  • Branches default
  • Tags 0.7

Comments (0)

Files changed (2)

File docs/conf.py

View file
  • Ignore whitespace
 # |version| and |release|, also used in various other places throughout the
 # built documents.
+# The full version, including alpha/beta/rc tags.
+from ordf import version as release
 # The short X.Y version.
-version = '0.6'
-# The full version, including alpha/beta/rc tags.
-release = '0.6'
+version = ".".join(release.split(".")[:2])
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

File ordf/command.py

View file
  • Ignore whitespace
     INFO  [ordf.load_n3/3148] Loading http://ordf.org/lens/rdfs
     INFO  [ordf.changeset] 612 changes urn:uuid:171ffd8c-8d12-11df-850a-001f5bef60ee
+In addition to the *-c* for specifying the config file and *-l* and *-v*
+for log file and debugging as with  :program:`ordf`, :program:`ordf_load_n3`
+supports these arguments:
 .. cmdoption:: -p, --package
     Name of the package (python module) to look for N3 fixtures in. This
     The Base URI for loading graphs into. The URI of the graph will be
     *base* + *filename* where *filename* has had the *.n3* extension
+Command Implementation -- :class:`Command`
+.. autoclass:: Command
 from ordf.graph import Graph
 from ordf.handler import init_handler
 import sys
 class Command(object):
+    """
+    This class is very similar to :class:`paste.script.command.Command` but
+    rather than implementing a :program:`paster` plugin it is for stand-alone
+    command line programs. To implement a command line program, sub-class this
+    class, and make a minimal method to instantiate and run it. As with the
+    paster counterpart you have to add an option parser and a method called 
+    :meth:`command`. A minimal example:
+    .. code-block:: python
+        class Hello(Command):
+            parser = Command.StandardParser(usage="%prog [options]")
+            def command(self):
+                print "hello world"
+        def hello():
+            Hello().command()
+    To create the actual script, in your package's *setup.py* needs an entry
+    point like::
+        [console_scripts]
+        hello=mypackage.command:hello
+    and then run one of::
+        % python setup.py develop
+        % python setup.py install
+    """
     def __init__(self):