A specialized Option Parser for recursing through directories.
|
__init__(self,
formats,
usetemplates=False,
allowmissingtemplate=False,
description=None)
Construct the specialized Option Parser. |
source code
|
|
|
|
|
setmanpageoption(self)
creates a manpage option that allows the optionparser to generate a
manpage |
source code
|
|
|
format_manpage(self)
returns a formatted manpage |
source code
|
|
|
print_manpage(self,
file=None)
outputs a manpage for the program using the help information |
source code
|
|
|
|
|
|
|
set_usage(self,
usage=None)
sets the usage string - if usage not given, uses getusagestring for
each option |
source code
|
|
|
warning(self,
msg,
options=None,
exc_info=None)
Print a warning message incorporating 'msg' to stderr and exit. |
source code
|
|
|
getusagestring(self,
option)
returns the usage string for the given option |
source code
|
|
|
getusageman(self,
option)
returns the usage string for the given option |
source code
|
|
|
define_option(self,
option)
defines the given option, replacing an existing one of the same short
name if neccessary... |
source code
|
|
|
setformats(self,
formats,
usetemplates)
Sets the format options using the given format dictionary. |
source code
|
|
|
setprogressoptions(self)
sets the progress options |
source code
|
|
|
seterrorleveloptions(self)
sets the errorlevel options |
source code
|
|
|
getformathelp(self,
formats)
make a nice help string for describing formats... |
source code
|
|
|
isrecursive(self,
fileoption,
filepurpose=' input ' )
checks if fileoption is a recursive file |
source code
|
|
|
parse_args(self,
args=None,
values=None)
parses the command line options, handling implicit input/output args |
source code
|
|
|
getpassthroughoptions(self,
options)
get the options required to pass to the filtermethod... |
source code
|
|
|
getoutputoptions(self,
options,
inputpath,
templatepath)
works out which output format and processor method to use... |
source code
|
|
|
initprogressbar(self,
allfiles,
options)
sets up a progress bar appropriate to the options and files |
source code
|
|
|
getfullinputpath(self,
options,
inputpath)
gets the absolute path to an input file |
source code
|
|
|
getfulloutputpath(self,
options,
outputpath)
gets the absolute path to an output file |
source code
|
|
|
getfulltemplatepath(self,
options,
templatepath)
gets the absolute path to a template file |
source code
|
|
|
run(self)
parses the arguments, and runs recursiveprocess with the resulting
options... |
source code
|
|
|
recursiveprocess(self,
options)
recurse through directories and process files |
source code
|
|
|
openinputfile(self,
options,
fullinputpath)
opens the input file |
source code
|
|
|
openoutputfile(self,
options,
fulloutputpath)
opens the output file |
source code
|
|
|
opentempoutputfile(self,
options,
fulloutputpath)
opens a temporary output file |
source code
|
|
|
finalizetempoutputfile(self,
options,
outputfile,
fulloutputpath)
write the temp outputfile to its final destination |
source code
|
|
|
opentemplatefile(self,
options,
fulltemplatepath)
opens the template file (if required) |
source code
|
|
|
processfile(self,
fileprocessor,
options,
fullinputpath,
fulloutputpath,
fulltemplatepath)
process an individual file |
source code
|
|
|
reportprogress(self,
filename,
success)
shows that we are progressing... |
source code
|
|
|
mkdir(self,
parent,
subdir)
makes a subdirectory (recursively if neccessary) |
source code
|
|
|
checkoutputsubdir(self,
options,
subdir)
checks to see if subdir under options.output needs to be created,
creates if neccessary |
source code
|
|
|
isexcluded(self,
options,
inputpath)
checks if this path has been excluded |
source code
|
|
|
recurseinputfilelist(self,
options)
use a list of files, and find a common base directory for them |
source code
|
|
|
recurseinputfiles(self,
options)
recurse through directories and return files to be processed... |
source code
|
|
|
splitext(self,
pathname)
splits into name and ext, and removes the extsep |
source code
|
|
|
splitinputext(self,
inputpath)
splits an inputpath into name and extension |
source code
|
|
|
splittemplateext(self,
templatepath)
splits a templatepath into name and extension |
source code
|
|
|
templateexists(self,
options,
templatepath)
returns whether the given template exists... |
source code
|
|
|
gettemplatename(self,
options,
inputname)
gets an output filename based on the input filename |
source code
|
|
|
getoutputname(self,
options,
inputname,
outputformat)
gets an output filename based on the input filename |
source code
|
|
|
isvalidinputname(self,
options,
inputname)
checks if this is a valid input filename |
source code
|
|
Inherited from optparse.OptionParser :
add_option_group ,
check_values ,
destroy ,
disable_interspersed_args ,
enable_interspersed_args ,
error ,
exit ,
expand_prog_name ,
format_epilog ,
format_help ,
format_option_help ,
get_default_values ,
get_description ,
get_option_group ,
get_usage ,
get_version ,
print_help ,
print_usage ,
print_version ,
set_default ,
set_defaults ,
set_process_default_values
Inherited from optparse.OptionParser (private):
_add_help_option ,
_add_version_option ,
_create_option_list ,
_get_all_options ,
_get_args ,
_get_encoding ,
_init_parsing_state ,
_match_long_opt ,
_populate_option_list ,
_process_args ,
_process_long_opt ,
_process_short_opts
Inherited from optparse.OptionContainer :
add_option ,
add_options ,
format_description ,
get_option ,
has_option ,
remove_option ,
set_conflict_handler ,
set_description
Inherited from optparse.OptionContainer (private):
_check_conflict ,
_create_option_mappings ,
_share_option_mappings
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__str__
|