Mercurial > hg > martINI
changeset 1:5627074cd79b
* adding ini-munge command
* bumping version
author | k0s <k0scist@gmail.com> |
---|---|
date | Tue, 08 Dec 2009 15:43:16 -0500 |
parents | 3c3522ce6e3a |
children | d172c078f4a2 |
files | martini/main.py setup.py |
diffstat | 2 files changed, 26 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/martini/main.py Tue Dec 08 15:13:28 2009 -0500 +++ b/martini/main.py Tue Dec 08 15:43:16 2009 -0500 @@ -1,6 +1,6 @@ #!/usr/bin/env python -usage = "martini file1 [file2] [...] --section1 option1=value1 option2=value2 --section2 option3=value3" +usage = "%s file1 [file2] [...] --section1 option1=value1 option2=value2 --section2 option3=value3" import config import os @@ -61,7 +61,7 @@ # display usage information if not files: print 'Usage:' - print usage + print usage % sys.argv[0] sys.exit(0) # process the files @@ -89,7 +89,7 @@ # display usage information if not files: print 'Usage:' - print usage + print usage % sys.argv[0] sys.exit(0) # process the files @@ -119,7 +119,7 @@ # display usage information if not files: print 'Usage:' - print usage + print usage % sys.argv[0] sys.exit(0) # process the files @@ -144,6 +144,24 @@ fp = file(f, 'w') config.ConfigMunger(conf).write(fp) +def munge(args=None): + + # process arguments + if args is None: + args = sys.argv[1:] + files, sections = parse_options(*args) + + # display usage information + if not files: + print 'Usage:' + print usage % sys.argv[0] + sys.exit(0) + + # munge the files + conf = list(files) + conf.append(sections) + munger = config.ConfigMunger(*conf) + munger.write(sys.stdout) if __name__ == '__main__': set(sys.argv[1:])
--- a/setup.py Tue Dec 08 15:13:28 2009 -0500 +++ b/setup.py Tue Dec 08 15:43:16 2009 -0500 @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import sys, os -version = '0.2.3' +version = '0.3' setup(name='martINI', version=version, @@ -11,8 +11,8 @@ classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers keywords='ini cli', author='Jeff Hammel', - author_email='jhammel@openplans.org', - url='http://k0s.org', + author_email='k0scist@gmail.com', + url='http://k0s.org/hg/martINI', license='GPL', packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), include_package_data=True, @@ -30,6 +30,7 @@ ini-get = martini.main:get ini-set = martini.main:set ini-delete = martini.main:delete + ini-munge = martini.main:munge [paste.app_factory] main = martini.web:factory