mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	Merged revisions 77267 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77267 | ezio.melotti | 2010-01-03 11:01:27 +0200 (Sun, 03 Jan 2010) | 1 line #7618: fix highlight of code blocks ........
This commit is contained in:
		
							parent
							
								
									b4066374db
								
							
						
					
					
						commit
						383ae95d72
					
				
					 1 changed files with 19 additions and 7 deletions
				
			
		| 
						 | 
					@ -51,7 +51,9 @@ Additionally, users can run one of  ::
 | 
				
			||||||
   <yourscript> -h
 | 
					   <yourscript> -h
 | 
				
			||||||
   <yourscript> --help
 | 
					   <yourscript> --help
 | 
				
			||||||
 | 
					
 | 
				
			||||||
and :mod:`optparse` will print out a brief summary of your script's options::
 | 
					and :mod:`optparse` will print out a brief summary of your script's options:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   usage: <yourscript> [options]
 | 
					   usage: <yourscript> [options]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -126,12 +128,16 @@ option argument
 | 
				
			||||||
   an argument that follows an option, is closely associated with that option,
 | 
					   an argument that follows an option, is closely associated with that option,
 | 
				
			||||||
   and is consumed from the argument list when that option is. With
 | 
					   and is consumed from the argument list when that option is. With
 | 
				
			||||||
   :mod:`optparse`, option arguments may either be in a separate argument from
 | 
					   :mod:`optparse`, option arguments may either be in a separate argument from
 | 
				
			||||||
   their option::
 | 
					   their option:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   .. code-block:: text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      -f foo
 | 
					      -f foo
 | 
				
			||||||
      --file foo
 | 
					      --file foo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   or included in the same argument::
 | 
					   or included in the same argument:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   .. code-block:: text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      -ffoo
 | 
					      -ffoo
 | 
				
			||||||
      --file=foo
 | 
					      --file=foo
 | 
				
			||||||
| 
						 | 
					@ -476,7 +482,9 @@ user-friendly (documented) options::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If :mod:`optparse` encounters either ``"-h"`` or ``"--help"`` on the
 | 
					If :mod:`optparse` encounters either ``"-h"`` or ``"--help"`` on the
 | 
				
			||||||
command-line, or if you just call :meth:`parser.print_help`, it prints the
 | 
					command-line, or if you just call :meth:`parser.print_help`, it prints the
 | 
				
			||||||
following to standard output::
 | 
					following to standard output:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   usage: <yourscript> [options] arg1 arg2
 | 
					   usage: <yourscript> [options] arg1 arg2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -549,7 +557,9 @@ parser is easy::
 | 
				
			||||||
    group.add_option("-g", action="store_true", help="Group option.")
 | 
					    group.add_option("-g", action="store_true", help="Group option.")
 | 
				
			||||||
    parser.add_option_group(group)
 | 
					    parser.add_option_group(group)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This would result in the following help output::
 | 
					This would result in the following help output:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    usage:  [options] arg1 arg2
 | 
					    usage:  [options] arg1 arg2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1126,7 +1136,9 @@ must specify for any option using that action.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  If :mod:`optparse` sees either ``"-h"`` or ``"--help"`` on the command line,
 | 
					  If :mod:`optparse` sees either ``"-h"`` or ``"--help"`` on the command line,
 | 
				
			||||||
  it will print something like the following help message to stdout (assuming
 | 
					  it will print something like the following help message to stdout (assuming
 | 
				
			||||||
  ``sys.argv[0]`` is ``"foo.py"``)::
 | 
					  ``sys.argv[0]`` is ``"foo.py"``):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .. code-block:: text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     usage: foo.py [options]
 | 
					     usage: foo.py [options]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1848,7 +1860,7 @@ would result in a list  ::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Again we define a subclass of Option::
 | 
					Again we define a subclass of Option::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   class MyOption (Option):
 | 
					   class MyOption(Option):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       ACTIONS = Option.ACTIONS + ("extend",)
 | 
					       ACTIONS = Option.ACTIONS + ("extend",)
 | 
				
			||||||
       STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
 | 
					       STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue