Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An extension of python optparse.OptionParser to read options and arguments from a file

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README

A simple python class wrapping optparse.OptionParser, it adds an option enabling to load remainig arguments and options from a text file. Useful if you have python scripts with plenty of options and want to save some typing on the command line.

The idea is adding a new option to option parser.

This option does the following:

It concatenates all the lines of the given text file to create a new string of options
This set of options built from the text file is appended to the original set of options given at command line,(or viceversa, depending on a precedence setting).
Obviously the --from-file option must be checked first. 

At zero cost, I added the possibility to add comment lines to text options file, just to make them more lsverbose and let them seem a lot more like configuration files. This is simply done by ignoring lines that .startswith( ...) your comment delimiter, # in my case.
Something went wrong with that request. Please try again.