Commits

Anonymous committed f4ca794 Draft

updated docs

Comments (0)

Files changed (1)

argparse_config.src/README.rst

 -----------------------------------------------------
 
 Included in the package is a utility to generate a config file following these
-rules, from a given set of commandline arguments. That looks like this::
+rules, from a given set of commandline arguments. The easy way to use it is to
+let it add a command to your args parsing::
+
+    >>> config_parser = get_config_parser('/home/tikitu/.my_hg.cfg')
+    >>> add_config_block_subcommand(arg_parser, sub_parsers, config_parser=config_parser)
+
+and use it on the commandline::
+
+    $ hg.py config default --repository ssh://hg@bitbucket.org/tikitu/argparse_config > new_config.rc
+    $ hg.py config commit --username 'Tikitu de Jager <tikitu@logophile.org>' >> new_config.rc
+    $ cat new_config.rc
+    [default]
+    repository: ssh://hg@bitbucket.org/tikitu/argparse_config
+    [commit]
+    username: Tikitu de Jager <tikitu@logophile.org>
+
+You can also use it programatically, if you like. That looks like this::
 
     >>> parsed_args = arg_parser.parse_args(['--repository', 'https://bitbucket.org/tikitu/argparse_config', 'merge'])
     >>> print argparse_config.generate_config(arg_parser, parsed_args, section='default', only_non_defaults=True)