Brian Mearns  committed b0e4b09

Added section on the API.

  • Participants
  • Parent commits 707b731

Comments (0)

Files changed (1)

 * [Examples](#markdown-header-examples)
 * [Installation](#markdown-header-installation)
 * [Screen Shots](#markdown-header-screen-shots)
+* [API](#markdown-header-api)
 * [Similar Extensions](#markdown-header-similar-extensions)
 * [See Also](#markdown-header-see-also)
 * [Recent activity](#repo-activity)
 For information on customizing the colors used by the extension, see [Config#Colors](
+## API
+This extension also provides a basic API that other mercurial extensions can use to poke around and modify
+configuration files, instead of hacking on the text themselves. Although this API is not yet documented well,
+you can take a look at the available functions in [](
+Most of them even have useful docstrings.
+To access the API from another extension, use the following python code:
+    :::python
+    import mercurial.extensions
+    hgcfg = mercurial.extensions.find('hgcfg')
+The `hgcfg` variable will then hold a `module` object, which you can use just like an imported module. For instance:
+    :::python
+    section = "ui"
+    key = "username"
+    value = "newusername"
+    scopes = ["local", "user"]
+    hgcfg.writevalue(ui, repo, section, key, value, scopes)
 ## Similar Extensions
 This extension was originally forked from the [`hgconfig`](