summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorsteven.bethard <devnull@localhost>2009-03-28 16:59:39 +0000
committersteven.bethard <devnull@localhost>2009-03-28 16:59:39 +0000
commit56ed68dff0cbad6f7891f7ebc124a98053b5f08d (patch)
treec29c2a989fcfb567f9d28e34d62b3f730e363ccc /doc
parent9ebaae668a8aa599985a8b299298233f82e41512 (diff)
downloadargparse-56ed68dff0cbad6f7891f7ebc124a98053b5f08d.tar.gz
Document print_help() and friends.
Diffstat (limited to 'doc')
-rw-r--r--doc/api-docs.html1
-rw-r--r--doc/other-methods.html26
-rw-r--r--doc/searchindex.js2
-rw-r--r--doc/source/other-methods.rst25
4 files changed, 53 insertions, 1 deletions
diff --git a/doc/api-docs.html b/doc/api-docs.html
index 8b62f39..bf62dec 100644
--- a/doc/api-docs.html
+++ b/doc/api-docs.html
@@ -86,6 +86,7 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference external" href="other-methods.html">Other methods</a><ul>
+<li class="toctree-l2"><a class="reference external" href="other-methods.html#printing-help">Printing help</a></li>
<li class="toctree-l2"><a class="reference external" href="other-methods.html#parser-defaults">Parser defaults</a></li>
<li class="toctree-l2"><a class="reference external" href="other-methods.html#sub-commands">Sub-commands</a></li>
<li class="toctree-l2"><a class="reference external" href="other-methods.html#argument-groups">Argument groups</a></li>
diff --git a/doc/other-methods.html b/doc/other-methods.html
index dd9397d..723d36e 100644
--- a/doc/other-methods.html
+++ b/doc/other-methods.html
@@ -49,6 +49,31 @@
<div class="section" id="other-methods">
<h1>Other methods<a class="headerlink" href="#other-methods" title="Permalink to this headline">¶</a></h1>
+<div class="section" id="printing-help">
+<h2>Printing help<a class="headerlink" href="#printing-help" title="Permalink to this headline">¶</a></h2>
+<p>In most typical applications, <a title="parse_args" class="reference external" href="parse_args.html#parse_args"><tt class="xref docutils literal"><span class="pre">parse_args()</span></tt></a> will take care of formatting and printing any usage or error messages. However, should you want to format or print these on your own, several methods are available:</p>
+<dl class="method">
+<dt>
+<tt class="descname">print_usage([file]):</tt></dt>
+<dd>Print a brief description of how the <a title="ArgumentParser" class="reference external" href="ArgumentParser.html#ArgumentParser"><tt class="xref docutils literal"><span class="pre">ArgumentParser</span></tt></a> should be invoked on the command line. If <tt class="docutils literal"><span class="pre">file</span></tt> is not present, <tt class="docutils literal"><span class="pre">sys.stderr</span></tt> is assumed.</dd></dl>
+
+<dl class="method">
+<dt>
+<tt class="descname">print_help([file]):</tt></dt>
+<dd>Print a help message, including the program usage and information about the arguments registered with the <a title="ArgumentParser" class="reference external" href="ArgumentParser.html#ArgumentParser"><tt class="xref docutils literal"><span class="pre">ArgumentParser</span></tt></a>. If <tt class="docutils literal"><span class="pre">file</span></tt> is not present, <tt class="docutils literal"><span class="pre">sys.stderr</span></tt> is assumed.</dd></dl>
+
+<p>There are also variants of these methods that simply return a string instead of printing it:</p>
+<dl class="method">
+<dt>
+<tt class="descname">format_usage():</tt></dt>
+<dd>Return a string containing a brief description of how the <a title="ArgumentParser" class="reference external" href="ArgumentParser.html#ArgumentParser"><tt class="xref docutils literal"><span class="pre">ArgumentParser</span></tt></a> should be invoked on the command line.</dd></dl>
+
+<dl class="method">
+<dt>
+<tt class="descname">format_help():</tt></dt>
+<dd>Return a string containing a help message, including the program usage and information about the arguments registered with the <a title="ArgumentParser" class="reference external" href="ArgumentParser.html#ArgumentParser"><tt class="xref docutils literal"><span class="pre">ArgumentParser</span></tt></a>.</dd></dl>
+
+</div>
<div class="section" id="parser-defaults">
<h2>Parser defaults<a class="headerlink" href="#parser-defaults" title="Permalink to this headline">¶</a></h2>
<dl class="method">
@@ -266,6 +291,7 @@
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference external" href="">Other methods</a><ul>
+<li><a class="reference external" href="#printing-help">Printing help</a></li>
<li><a class="reference external" href="#parser-defaults">Parser defaults</a></li>
<li><a class="reference external" href="#sub-commands">Sub-commands</a></li>
<li><a class="reference external" href="#argument-groups">Argument groups</a></li>
diff --git a/doc/searchindex.js b/doc/searchindex.js
index 926a85a..e7e3c3d 100644
--- a/doc/searchindex.js
+++ b/doc/searchindex.js
@@ -1 +1 @@
-Search.setIndex({desctypes:{"0":"method","1":"class"},terms:{all:[6,3,7,5,2],code:[0,7,6],partial:7,messg:7,whatev:2,illustr:[7,5],global:6,four:5,prefix:[1,6,5],follow:[0,7,5,6,3],concaten:1,formatter_class:[8,6],whose:[5,6],typeerror:5,"const":[8,3,7,1,5],readabl:4,prefix_char:[8,7,6],program:[6,0,5,2,3],those:[7,1],sens:5,worth:5,consum:[7,5],everi:3,string:[3,7,1,6,5],fals:[6,7,5,2],subcommand:7,util:[8,0,4],prog:[1,2,5,6,7,8],default_:6,exact:7,implement:5,level:2,list:[1,2,3,5,6,7],"try":[7,6],item:5,adjust:6,readi:3,pleas:6,subparser_nam:2,bacon:1,dogmat:7,past:7,zero:[7,5],fyoyo:7,group1:2,pass:[4,7,1,6,5],append:5,compat:7,what:[3,7,1,6,5],abc:[7,5],sub:[8,7,2],neg:1,section:[6,7,5,2],advanc:7,brief:[5,6],current:2,abbrevi:[8,1],version:[8,6],"new":[7,1,6,5],method:[0,1,2,3,5,6,7,8],told:5,deriv:[7,5],gener:[0,7,5,6,3],never:7,here:[7,1],let:2,inher:1,path:7,along:1,standard:7,modifi:2,sinc:7,interpret:5,convert:[3,4,7,1,5],convers:5,pick:1,action:[1,2,3,5,6,7,8],weird:6,commonli:5,regardless:6,extra:1,appli:5,modul:[0,7,5,3],prefer:7,"while":[7,1,5],filenam:5,api:[8,0,7,5],txt:[0,5],select:[5,2],add_argument_group:2,from:[1,2,3,5,6,7],describ:[6,5,2],would:[7,5],frobbl:[5,2],two:[3,1,6,5],few:[7,5],call:[0,1,2,3,5,6,7],add_help:[8,7,6,2],recommend:2,taken:[7,1,5],care:7,type:[0,1,2,3,4,5,6,7,8],tell:[3,1],more:[0,1,3,5,6,7],sort:[3,5,6],parser_a:2,parser_b:2,line:[0,1,2,3,4,5,6,7],notic:[7,1],warn:5,flag:[8,7,5],indic:[6,5,2],particular:[7,5,2],known:7,hold:[3,5],easiest:[7,5,2],must:[1,5],dictat:7,none:[4,7,1,6,5],word:6,work:[6,2],conceptu:2,remain:[3,7,5],kwarg:[7,2],can:[0,1,2,3,4,5,6,7],def:[7,5,2],overrid:[7,6,2],omit:5,prompt:1,puriti:7,give:[1,6],frabbl:3,share:[7,6],add_argu:[0,1,2,3,4,5,6,7,8],accept:[7,5,2],cautiou:1,want:[3,7,5,6],alwai:[6,5,2],multipl:[7,5,2],turn:3,rather:[1,6],anoth:[5,6],check_method:7,fooaction:[7,5],write:[0,7,3],how:[3,1,6,5],"__init__":7,instead:[7,5],narg:[0,1,3,5,6,7,8],simpl:[0,7,5,3],updat:2,parser_abc:7,foo_pars:[7,6],overridden:6,mess:6,max:[3,1],after:[6,7,1,2,5],befor:[5,6],wrong:1,okai:6,mai:[6,7,1,2,5],end:[7,5,2],associ:[5,2],xfoox:7,"0x013a2410":5,"short":[1,6,5],store_tru:[3,7,1,2,5],practic:7,read:5,stdin:[4,5],explicit:5,correspond:[3,7],ambigu:1,caus:6,inform:[3,7],type_:[],maintain:[7,6],combin:[1,2],allow:[6,7,1,2,5],callabl:[7,5],origin:7,least:[5,2],help:[0,1,2,3,5,6,7,8],over:7,becaus:6,through:7,sqrt:5,hierarchi:7,metavar_:[],still:5,subparser2:2,subparser1:2,paramet:[7,5,6],style:1,interspers:7,group:[8,2],fit:6,better:[7,2],main:2,easier:1,them:[0,5,1,6,3],good:2,"return":[3,7,1,2,5],thei:[7,1,6,5],python:[0,7,6,2],initi:[3,5],option_str:[7,5],now:[3,7],discuss:7,introduct:[0,3],choic:[1,2,3,5,7,8],allow_interspersed_arg:7,optionerror:7,name:[1,2,3,5,6,7,8],anyth:[7,5],choices_:[],separ:[1,2],easili:7,achiev:[1,6],mode:[4,7,5],each:[6,3,7,5,2],fulli:2,complet:2,mean:[3,7,5],myprogram:6,replac:7,idea:2,heavi:1,expect:[3,1,5],our:3,happen:7,beyond:[8,1],metavar:[0,1,3,5,7,8],special:[5,2],out:[0,4,5,3],variabl:7,accomplish:[1,6],space:6,foo_bar:5,newli:1,parser_xyz:7,perfect_squar:5,print:[1,2,3,5,6,7],factori:[4,5],math:5,bac:1,optionvalueerror:7,worthwhil:7,situat:[1,5],given:6,argv:[8,3,1,6],infil:[4,5],mmm:1,reason:7,base:7,dictionari:7,rawtexthelpformatt:6,indent:6,could:[1,5],traceback:6,refus:7,thing:5,isn:[7,5],retain:6,const_:[],assign:1,first:5,oper:5,rang:[3,1],directli:5,carri:3,onc:3,number:[6,7,1,2,5],restrict:5,instruct:3,alreadi:[7,1,6],construct:[7,6],wasn:5,open:[4,7,5],size:4,differ:[7,5,2],script:3,top:2,sometim:[6,1,2],messag:[0,1,2,5,6,7],too:5,similarli:2,gather:5,conveni:[7,5],"final":[],store:[3,5],monkei:7,option:[0,1,2,3,5,6,7,8],namespac:[1,2,3,4,5,6,7,8],copi:7,specifi:[0,1,2,3,5,6,7],pars:[0,1,2,3,5,7],attempt:[7,1],exactli:[3,1,6],than:[6,7,1,2,5],wide:6,kind:2,setattr:[7,5],whenev:[1,5],provid:[0,7,1,2,5],remov:6,charact:[7,1,6,5],str:5,were:5,posit:[0,1,2,3,5,6,7],seri:[3,5],sai:7,behavior:[3,5,6],"0x013a2380":4,group2:2,argument:[0,1,2,3,4,5,6,7,8],dash:7,add_pars:[7,2],manner:[3,7],have:[4,7,1,6,5],"__main__":[0,3],need:[6,7,5,2],seem:7,probabl:5,built:[3,1],callback:7,self:[7,5],append_const:5,also:[6,1,2,5],builtin:5,without:2,take:[1,2,3,5,6,7],which:[6,7,1,2,5],singl:[1,2,3,5,6,7],uppercas:5,begin:[3,1],sure:[7,5,2],though:5,buffer:4,previou:[7,1],most:[6,3,7,5,2],regular:2,pair:[7,6],choos:[7,5],"class":[4,7,1,6,5],don:[7,1,5],later:3,request:[4,5,2],doe:[7,5,6],declar:7,determin:[1,2,3,5,6,7],occasion:6,sum:[0,1,3],"0x00b8fb18":5,parser_bar:2,show:[6,0,7,5,2],text:6,filetyp:[8,0,4,5],syntax:[8,7,1],particularli:[7,2],hack:7,find:[3,1,2],onli:[6,7,1,2,5],execut:2,pretti:3,"true":[1,2,3,5,6,7],parser_foo:2,written:0,should:[0,2,3,5,6,7],store_const:[3,7,1,5],wood:1,dict:5,"__call__":[7,5],add_opt:7,variou:[5,6],get:[3,7,1,6],likewis:6,report:5,requir:[8,7,1,2,5],bar:[1,2,3,5,6,7],keyword:[1,2,3,5,6,7],baz:[7,5,2],dramat:7,patch:7,store_fals:[5,2],"default":[0,1,2,3,5,6,7,8],bad:[1,5],calcul:6,common:[3,5,6],contain:[1,2,5,6,7,8],where:[0,5,6],set:[6,3,7,5,2],see:[1,2,3,5,6,7],arg:[0,1,2,3,4,5,6,7],close:0,parent:[8,7,6,2],correctli:6,someth:3,figur:5,subdir:6,between:6,"import":[0,7,5,6,3],awai:5,badger:[7,1,2],across:6,attribut:[1,2,3,5,6,7],extend:[7,5],xrang:[3,7,1,5],disallow:[7,6],extens:7,outfil:5,come:7,addit:[6,7,5,2],both:[7,1],last:[1,6],howev:[6,7,5,2],against:7,etc:[7,1,2,5],mani:[7,5],simpli:[7,1,6,5],point:7,within:6,argumentpars:[0,1,2,3,4,5,6,7,8],dispatch:7,suppli:[6,3,7,5,2],respect:5,assum:[0,5,3],duplic:7,quit:[7,5],coupl:[6,2],addition:5,empti:1,implicit:7,accumul:[3,1],secret:7,much:[3,7,1,5],valu:[8,7,1,6,5],basic:5,unambigu:1,popul:1,strategi:6,epilog:[8,6],suppress:[7,5,6],xxx:[7,5,6],great:5,ani:[6,7,5,2],understand:4,togeth:[1,5],func:2,child:6,repetit:5,present:[7,1,2,5],"case":[3,1,5],therefor:5,look:[3,7,1],defin:[6,5,2],invok:[6,3,7,5,2],abov:[6,0,1,2,3],error:[6,7,1,2,5],argpars:[0,1,2,3,4,5,6,7],advantag:[0,7],stdout:[0,4,5],almost:[5,6],itself:5,sever:[6,1,2],disabl:6,clearli:1,perform:[5,2],make:[6,3,7,5,2],transpar:7,same:[7,5,6],handl:[7,5,2],complex:[7,5],help_:[],split:[1,2,3,5,6,7],document:[8,0,1],infer:5,dest_:[],difficult:7,dedent:6,foo_bar_baz_pars:7,effect:2,rais:[5,6],user:[6,7,1,2,5],store_act:7,typic:[3,7,5,2],recent:6,appropri:[0,2,3,5,6,7],older:6,thu:7,inherit:[7,6],exampl:[0,1,2,3,5,6],command:[0,1,2,3,4,5,6,7,8],thi:[0,1,2,3,4,5,6,7],conflict:6,everyth:[7,1],sibl:2,usual:[6,7,5,2],identifi:5,just:[5,2],object:[0,1,2,3,4,5,6,7,8],add_mutually_exclusive_group:2,note:[6,7,5,2],action_:[],exclus:[8,2],expos:7,had:7,except:6,add:[0,2,3,5,6,7],other:[0,1,2,4,7,8],remaining_arg:7,rawdescriptionhelpformatt:6,save:[0,3],match:[6,7,1,2,5],applic:6,format:[7,5,6],dest:[1,2,3,5,7,8],textwrap:6,test:7,know:[7,5,2],insert:[1,6],like:[1,2,3,5,6,7],specif:6,arbitrari:5,whitespac:6,manual:7,resolv:6,integ:[0,5,7,1,3],collect:6,necessari:[3,7,5,2],either:[3,7,1,6,5],argumenterror:[7,6],output:[4,5,6],unnecessari:6,encount:[3,1,5],old:[6,2],often:5,"0x00b1f020":5,interact:1,some:[1,2,3,5,6,7],back:2,intern:5,suppl:2,mistak:1,proper:7,librari:7,subpars:[7,2],avoid:5,normal:[1,2,5],definit:6,exit:[0,1,2,5,6,7],parent_pars:6,foo:[1,2,3,5,6,7],refer:[1,5],nargs_:[],print_help:[6,7,5,2],run:[0,3],inspect:[3,2],usag:[0,1,2,5,6,7,8],argument_default:[8,6],found:1,add_subpars:[7,2],"__name__":[0,3],"super":7,xyzz:1,about:[3,7,5],simplest:1,actual:7,callback_:7,optpars:[0,7],constructor:[7,6,2],commit:2,produc:[7,5],own:[7,5,6],xyz:[7,2],"float":[7,5,2],automat:[4,5],upgrad:[0,7],been:[3,7,5],strip:5,wrap:6,chang:[6,7,5,2],mark:5,yyi:[5,6],your:[6,3,7,5,2],manag:3,inclus:5,log:0,wai:[6,7,1,2,5],spam:[7,1,2],support:[6,7,1,2,5],"long":[7,1,5],custom:[6,8,1,2,5],avail:[5,6],start:3,interfac:[0,7,5,3],includ:[6,7,1,2,5],lot:[7,2],parse_arg:[0,1,2,3,4,5,6,7,8],treat:2,"function":[1,2,5],svn:2,creation:[6,2],form:[3,7,5],bufsiz:[4,5],parents_:[],"0x00b8fe78":5,eas:5,conflict_handl:[8,6],absent:5,made:1,input:5,temp:5,possibl:5,whether:[5,6],checkout:2,displai:[6,7,5,2],below:[7,5,6],otherwis:6,similar:7,featur:7,constant:5,creat:[0,1,2,3,4,5,6,7],"int":[0,1,2,3,5,6,7],pseudo:[4,1],parser:[0,1,2,3,4,5,6,7,8],"0x00b1f068":5,doesn:[7,5],strongli:2,exist:1,file:[0,3,4,5,6,7],xyzyx:2,check:[7,1,2,5],fill:[3,6],again:7,mutual:[8,2],titl:2,when:[0,1,2,3,5,6,7],detail:[1,6,5],invalid:[8,7,1,5],valid:[7,5],futur:2,scriptnam:0,varieti:1,writabl:[4,5],set_default:[6,2],you:[1,2,3,5,6,7],bar_pars:[7,6],repeat:6,clean:6,why:7,consid:[5,6],"0x00adf020":4,reduc:7,receiv:7,longer:[7,1,2],descript:[0,2,3,5,6,8],time:[7,5,2],backward:7},titles:["Documentation","The parse_args() method","Other methods","Introduction to argparse","Other utilities","The add_argument() method","ArgumentParser objects","argparse vs. optparse","API documentation"],modules:{},descrefs:{"":{parse_args:[1,0],add_mutually_exclusive_group:[2,0],set_defaults:[2,0],FileType:[4,1],add_argument:[5,0],ArgumentParser:[6,1],add_subparsers:[2,0],add_argument_group:[2,0]}},filenames:["index","parse_args","other-methods","overview","other-utilities","add_argument","ArgumentParser","argparse-vs-optparse","api-docs"]}) \ No newline at end of file
+Search.setIndex({desctypes:{"0":"method","1":"class"},terms:{all:[6,3,7,5,2],code:[0,7,6],partial:7,messg:7,whatev:2,illustr:[7,5],global:6,four:5,prefix:[1,6,5],follow:[0,7,5,6,3],concaten:1,formatter_class:[8,6],whose:[5,6],typeerror:5,"const":[8,3,7,1,5],readabl:4,prefix_char:[8,7,6],program:[6,0,5,2,3],those:[7,1],sens:5,worth:5,consum:[7,5],everi:3,string:[1,2,3,5,6,7],fals:[6,7,5,2],subcommand:7,util:[8,0,4],prog:[1,2,5,6,7,8],default_:6,exact:7,implement:5,level:2,list:[1,2,3,5,6,7],"try":[7,6],item:5,adjust:6,stderr:2,pleas:6,subparser_nam:2,bacon:1,dogmat:7,past:7,zero:[7,5],fyoyo:7,group1:2,pass:[4,7,1,6,5],append:5,compat:7,what:[3,7,1,6,5],abc:[7,5],sub:[8,7,2],neg:1,section:[6,7,5,2],advanc:7,brief:[6,5,2],current:2,abbrevi:[8,1],version:[8,6],"new":[7,1,6,5],method:[0,1,2,3,5,6,7,8],told:5,deriv:[7,5],gener:[0,7,5,6,3],never:7,here:[7,1],let:2,inher:1,path:7,along:1,standard:7,modifi:2,sinc:7,interpret:5,convert:[3,4,7,1,5],convers:5,later:3,pick:1,action:[1,2,3,5,6,7,8],weird:6,almost:[5,6],commonli:5,regardless:6,extra:1,appli:5,modul:[0,7,5,3],prefer:7,"while":[7,1,5],filenam:5,api:[8,0,7,5],txt:[0,5],select:[5,2],add_argument_group:2,from:[1,2,3,5,6,7],describ:[6,5,2],would:[7,5],frobbl:[5,2],regist:2,two:[3,1,6,5],few:[7,5],call:[0,1,2,3,5,6,7],add_help:[8,7,6,2],recommend:2,taken:[7,1,5],care:[7,2],type:[0,1,2,3,4,5,6,7,8],tell:[3,1],more:[0,1,3,5,6,7],sort:[3,5,6],parser_a:2,parser_b:2,line:[0,1,2,3,4,5,6,7],notic:[7,1],warn:5,flag:[8,7,5],indic:[6,5,2],particular:[7,5,2],known:7,hold:[3,5],easiest:[7,5,2],must:[1,5],dictat:7,none:[4,7,1,6,5],word:6,work:[6,2],conceptu:2,remain:[3,7,5],kwarg:[7,2],can:[0,1,2,3,4,5,6,7],def:[7,5,2],overrid:[7,6,2],omit:5,prompt:1,puriti:7,give:[1,6],frabbl:3,share:[7,6],add_argu:[0,1,2,3,4,5,6,7,8],accept:[7,5,2],cautiou:1,want:[6,3,7,5,2],alwai:[6,5,2],multipl:[7,5,2],turn:3,rather:[1,6],anoth:[5,6],check_method:7,fooaction:[7,5],write:[0,7,3],how:[6,3,1,2,5],"__init__":7,instead:[7,5,2],narg:[0,1,3,5,6,7,8],simpl:[0,7,5,3],updat:2,parser_abc:7,foo_pars:[7,6],overridden:6,mess:6,max:[3,1],after:[6,7,1,2,5],variant:2,befor:[5,6],wrong:1,okai:6,mai:[6,7,1,2,5],end:[7,5,2],associ:[5,2],xfoox:7,"0x013a2410":5,"short":[1,6,5],store_tru:[3,7,1,2,5],practic:7,read:5,stdin:[4,5],explicit:5,correspond:[3,7],ambigu:1,caus:6,inform:[3,7,2],type_:[],maintain:[7,6],combin:[1,2],allow:[6,7,1,2,5],callabl:[7,5],origin:7,least:[5,2],help:[0,1,2,3,5,6,7,8],over:7,becaus:6,through:7,sqrt:5,hierarchi:7,metavar_:[],still:5,subparser2:2,subparser1:2,paramet:[7,5,6],style:1,interspers:7,group:[8,2],fit:6,better:[7,2],main:2,easier:1,them:[0,5,1,6,3],good:2,"return":[3,7,1,2,5],thei:[7,1,6,5],python:[0,7,6,2],initi:[3,5],option_str:[7,5],now:[3,7],discuss:7,introduct:[0,3],choic:[1,2,3,5,7,8],allow_interspersed_arg:7,optionerror:7,name:[1,2,3,5,6,7,8],anyth:[7,5],choices_:[],separ:[1,2],easili:7,achiev:[1,6],mode:[4,7,5],each:[6,3,7,5,2],fulli:2,complet:2,mean:[3,7,5],myprogram:6,replac:7,idea:2,heavi:1,expect:[3,1,5],our:3,happen:7,beyond:[8,1],metavar:[0,1,3,5,7,8],special:[5,2],out:[0,4,5,3],variabl:7,accomplish:[1,6],space:6,foo_bar:5,newli:1,parser_xyz:7,perfect_squar:5,print:[1,2,3,5,6,7,8],factori:[4,5],math:5,bac:1,optionvalueerror:7,worthwhil:7,situat:[1,5],given:6,argv:[8,3,1,6],infil:[4,5],mmm:1,reason:7,base:7,dictionari:7,rawtexthelpformatt:6,indent:6,could:[1,5],traceback:6,refus:7,thing:5,isn:[7,5],retain:6,const_:[],assign:1,first:5,oper:5,rang:[3,1],directli:5,carri:3,onc:3,number:[6,7,1,2,5],restrict:5,instruct:3,alreadi:[7,1,6],construct:[7,6],wasn:5,open:[4,7,5],size:4,differ:[7,5,2],script:3,top:2,sometim:[6,1,2],messag:[0,1,2,5,6,7],too:5,similarli:2,conveni:[7,5],"final":[],store:[3,5],monkei:7,option:[0,1,2,3,5,6,7,8],namespac:[1,2,3,4,5,6,7,8],copi:7,specifi:[0,1,2,3,5,6,7],pars:[0,1,2,3,5,7],attempt:[7,1],exactli:[3,1,6],than:[6,7,1,2,5],format_usag:2,wide:6,kind:2,setattr:[7,5],whenev:[1,5],provid:[0,7,1,2,5],remov:6,charact:[7,1,6,5],str:5,were:5,posit:[0,1,2,3,5,6,7],seri:[3,5],sai:7,behavior:[3,5,6],"0x013a2380":4,group2:2,argument:[0,1,2,3,4,5,6,7,8],dash:7,add_pars:[7,2],manner:[3,7],have:[4,7,1,6,5],"__main__":[0,3],need:[6,7,5,2],seem:7,probabl:5,built:[3,1],callback:7,self:[7,5],append_const:5,also:[6,1,2,5],builtin:5,without:2,take:[1,2,3,5,6,7],which:[6,7,1,2,5],singl:[1,2,3,5,6,7],uppercas:5,begin:[3,1],sure:[7,5,2],though:5,buffer:4,previou:[7,1],most:[6,3,7,5,2],regular:2,pair:[7,6],choos:[7,5],"class":[4,7,1,6,5],don:[7,1,5],gather:5,request:[4,5,2],doe:[7,5,6],declar:7,determin:[1,2,3,5,6,7],occasion:6,sum:[0,1,3],"0x00b8fb18":5,parser_bar:2,show:[6,0,7,5,2],text:6,filetyp:[8,0,4,5],syntax:[8,7,1],particularli:[7,2],hack:7,find:[3,1,2],onli:[6,7,1,2,5],execut:2,pretti:3,"true":[1,2,3,5,6,7],parser_foo:2,written:0,should:[0,2,3,5,6,7],store_const:[3,7,1,5],wood:1,dict:5,"__call__":[7,5],add_opt:7,variou:[5,6],get:[3,7,1,6],likewis:6,report:5,requir:[8,7,1,2,5],bar:[1,2,3,5,6,7],keyword:[1,2,3,5,6,7],baz:[7,5,2],dramat:7,patch:7,store_fals:[5,2],"default":[0,1,2,3,5,6,7,8],bad:[1,5],calcul:6,common:[3,5,6],contain:[1,2,5,6,7,8],where:[0,5,6],set:[6,3,7,5,2],see:[1,2,3,5,6,7],arg:[0,1,2,3,4,5,6,7],close:0,parent:[8,7,6,2],correctli:6,someth:3,figur:5,subdir:6,between:6,"import":[0,7,5,6,3],awai:5,badger:[7,1,2],across:6,attribut:[1,2,3,5,6,7],extend:[7,5],xrang:[3,7,1,5],disallow:[7,6],extens:7,outfil:5,come:7,addit:[6,7,5,2],both:[7,1],last:[1,6],howev:[6,7,5,2],against:7,etc:[7,1,2,5],mani:[7,5],simpli:[6,7,1,2,5],point:7,within:6,argumentpars:[0,1,2,3,4,5,6,7,8],dispatch:7,suppli:[6,3,7,5,2],respect:5,assum:[0,5,2,3],duplic:7,quit:[7,5],coupl:[6,2],addition:5,empti:1,implicit:7,accumul:[3,1],secret:7,much:[3,7,1,5],valu:[8,7,1,6,5],basic:5,unambigu:1,print_usag:2,popul:1,strategi:6,epilog:[8,6],suppress:[7,5,6],xxx:[7,5,6],great:5,ani:[6,7,5,2],understand:4,togeth:[1,5],func:2,child:6,repetit:5,present:[7,1,2,5],"case":[3,1,5],therefor:5,look:[3,7,1],format_help:2,defin:[6,5,2],invok:[6,3,7,5,2],abov:[6,0,1,2,3],error:[6,7,1,2,5],argpars:[0,1,2,3,4,5,6,7],advantag:[0,7],stdout:[0,4,5],readi:3,itself:5,sever:[6,1,2],disabl:6,clearli:1,perform:[5,2],make:[6,3,7,5,2],transpar:7,same:[7,5,6],handl:[7,5,2],complex:[7,5],help_:[],split:[1,2,3,5,6,7],document:[8,0,1],infer:5,dest_:[],difficult:7,dedent:6,foo_bar_baz_pars:7,effect:2,rais:[5,6],user:[6,7,1,2,5],store_act:7,typic:[3,7,5,2],recent:6,appropri:[0,2,3,5,6,7],older:6,thu:7,inherit:[7,6],exampl:[0,1,2,3,5,6],command:[0,1,2,3,4,5,6,7,8],thi:[0,1,2,3,4,5,6,7],conflict:6,everyth:[7,1],sibl:2,usual:[6,7,5,2],identifi:5,just:[5,2],object:[0,1,2,3,4,5,6,7,8],add_mutually_exclusive_group:2,note:[6,7,5,2],action_:[],exclus:[8,2],expos:7,had:7,except:6,add:[0,2,3,5,6,7],other:[0,1,2,4,7,8],remaining_arg:7,rawdescriptionhelpformatt:6,save:[0,3],match:[6,7,1,2,5],applic:[6,2],format:[6,7,5,2],dest:[1,2,3,5,7,8],textwrap:6,test:7,know:[7,5,2],insert:[1,6],like:[1,2,3,5,6,7],specif:6,arbitrari:5,whitespac:6,manual:7,resolv:6,integ:[0,5,7,1,3],collect:6,necessari:[3,7,5,2],either:[3,7,1,6,5],argumenterror:[7,6],output:[4,5,6],unnecessari:6,encount:[3,1,5],old:[6,2],often:5,"0x00b1f020":5,interact:1,some:[1,2,3,5,6,7],back:2,intern:5,suppl:2,mistak:1,proper:7,librari:7,subpars:[7,2],avoid:5,normal:[1,2,5],definit:6,exit:[0,1,2,5,6,7],parent_pars:6,foo:[1,2,3,5,6,7],refer:[1,5],nargs_:[],print_help:[6,7,5,2],run:[0,3],inspect:[3,2],usag:[0,1,2,5,6,7,8],argument_default:[8,6],found:1,add_subpars:[7,2],"__name__":[0,3],"super":7,xyzz:1,about:[3,7,5,2],simplest:1,actual:7,callback_:7,optpars:[0,7],constructor:[7,6,2],commit:2,produc:[7,5],own:[6,7,5,2],xyz:[7,2],"float":[7,5,2],automat:[4,5],upgrad:[0,7],been:[3,7,5],strip:5,wrap:6,chang:[6,7,5,2],mark:5,yyi:[5,6],your:[6,3,7,5,2],manag:3,inclus:5,log:0,wai:[6,7,1,2,5],spam:[7,1,2],support:[6,7,1,2,5],"long":[7,1,5],custom:[6,8,1,2,5],avail:[6,5,2],start:3,interfac:[0,7,5,3],includ:[6,7,1,2,5],lot:[7,2],parse_arg:[0,1,2,3,4,5,6,7,8],treat:2,"function":[1,2,5],svn:2,creation:[6,2],form:[3,7,5],bufsiz:[4,5],parents_:[],"0x00b8fe78":5,eas:5,conflict_handl:[8,6],absent:5,made:1,input:5,temp:5,possibl:5,whether:[5,6],checkout:2,displai:[6,7,5,2],below:[7,5,6],otherwis:6,similar:7,featur:7,constant:5,creat:[0,1,2,3,4,5,6,7],"int":[0,1,2,3,5,6,7],pseudo:[4,1],parser:[0,1,2,3,4,5,6,7,8],"0x00b1f068":5,doesn:[7,5],strongli:2,exist:1,file:[0,2,3,4,5,6,7],xyzyx:2,check:[7,1,2,5],fill:[3,6],again:7,mutual:[8,2],titl:2,when:[0,1,2,3,5,6,7],detail:[1,6,5],invalid:[8,7,1,5],valid:[7,5],futur:2,scriptnam:0,varieti:1,writabl:[4,5],set_default:[6,2],you:[1,2,3,5,6,7],bar_pars:[7,6],repeat:6,clean:6,why:7,consid:[5,6],"0x00adf020":4,reduc:7,receiv:7,longer:[7,1,2],descript:[0,2,3,5,6,8],time:[7,5,2],backward:7},titles:["Documentation","The parse_args() method","Other methods","Introduction to argparse","Other utilities","The add_argument() method","ArgumentParser objects","argparse vs. optparse","API documentation"],modules:{},descrefs:{"":{parse_args:[1,0],add_mutually_exclusive_group:[2,0],set_defaults:[2,0],FileType:[4,1],add_argument:[5,0],ArgumentParser:[6,1],add_subparsers:[2,0],add_argument_group:[2,0]}},filenames:["index","parse_args","other-methods","overview","other-utilities","add_argument","ArgumentParser","argparse-vs-optparse","api-docs"]}) \ No newline at end of file
diff --git a/doc/source/other-methods.rst b/doc/source/other-methods.rst
index cd86d8f..1003aa3 100644
--- a/doc/source/other-methods.rst
+++ b/doc/source/other-methods.rst
@@ -1,6 +1,31 @@
Other methods
=============
+Printing help
+-------------
+
+In most typical applications, :meth:`parse_args` will take care of formatting and printing any usage or error messages. However, should you want to format or print these on your own, several methods are available:
+
+.. method:: print_usage([file]):
+
+ Print a brief description of how the :class:`ArgumentParser` should be invoked on the command line. If ``file`` is not present, ``sys.stderr`` is assumed.
+
+.. method:: print_help([file]):
+
+ Print a help message, including the program usage and information about the arguments registered with the :class:`ArgumentParser`. If ``file`` is not present, ``sys.stderr`` is assumed.
+
+There are also variants of these methods that simply return a string instead of printing it:
+
+.. method:: format_usage():
+
+ Return a string containing a brief description of how the :class:`ArgumentParser` should be invoked on the command line.
+
+.. method:: format_help():
+
+ Return a string containing a help message, including the program usage and information about the arguments registered with the :class:`ArgumentParser`.
+
+
+
Parser defaults
---------------