[Python-checkins] CVS: python/dist/src/Tools/scripts reindent.py,1.3,1.4

Skip Montanaro montanaro@users.sourceforge.net
2002年3月26日 03:39:29 -0800


Update of /cvsroot/python/python/dist/src/Tools/scripts
In directory usw-pr-cvs1:/tmp/cvs-serv12414
Modified Files:
	reindent.py 
Log Message:
operate as a filter when no files or directories appear on the command line
Index: reindent.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/reindent.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** reindent.py	17 Feb 2002 07:03:05 -0000	1.3
--- reindent.py	26 Mar 2002 11:39:26 -0000	1.4
***************
*** 3,7 ****
 # Released to the public domain, by Tim Peters, 03 October 2000.
 
! """reindent [-d][-r][-v] path ...
 
 -d Dry run. Analyze, but don't make any changes to, files.
--- 3,7 ----
 # Released to the public domain, by Tim Peters, 03 October 2000.
 
! """reindent [-d][-r][-v] [ path ... ]
 
 -d Dry run. Analyze, but don't make any changes to, files.
***************
*** 13,24 ****
 at the end of files. Also ensure the last line ends with a newline.
 
! Pass one or more file and/or directory paths. When a directory path, all
! .py files within the directory will be examined, and, if the -r option is
! given, likewise recursively for subdirectories.
 
! Overwrites files in place, renaming the originals with a .bak extension.
! If reindent finds nothing to change, the file is left alone. If reindent
! does change a file, the changed file is a fixed-point for reindent (i.e.,
! running reindent on the resulting .py file won't change it again).
 
 The hard part of reindenting is figuring out what to do with comment
--- 13,30 ----
 at the end of files. Also ensure the last line ends with a newline.
 
! If no paths are given on the command line, reindent operates as a filter,
! reading a single source file from standard input and writing the transformed
! source to standard output. In this case, the -d, -r and -v flags are
! ignored.
 
! You can pass one or more file and/or directory paths. When a directory
! path, all .py files within the directory will be examined, and, if the -r
! option is given, likewise recursively for subdirectories.
! 
! If output is not to standard output, reindent overwrites files in place,
! renaming the originals with a .bak extension. If it finds nothing to
! change, the file is left alone. If reindent does change a file, the changed
! file is a fixed-point for future runs (i.e., running reindent on the
! resulting .py file won't change it again).
 
 The hard part of reindenting is figuring out what to do with comment
***************
*** 60,64 ****
 verbose += 1
 if not args:
! errprint("Usage:", __doc__)
 return
 for arg in args:
--- 66,72 ----
 verbose += 1
 if not args:
! r = Reindenter(sys.stdin)
! r.run()
! r.write(sys.stdout)
 return
 for arg in args:

AltStyle によって変換されたページ (->オリジナル) /