src/eric7/eric7_doc.py

branch
eric7
changeset 10298
a148416e7e7d
parent 10296
2d3218cb56dc
child 10303
ee1aadab1215
equal deleted inserted replaced
10297:019045db2bec 10298:a148416e7e7d
40 @rtype argparse.ArgumentParser 40 @rtype argparse.ArgumentParser
41 """ 41 """
42 parser = argparse.ArgumentParser( 42 parser = argparse.ArgumentParser(
43 description="Create source code documentation files.", 43 description="Create source code documentation files.",
44 epilog="Copyright (c) 2004 - 2023 Detlev Offenbach <detlev@die-offenbachs.de>.", 44 epilog="Copyright (c) 2004 - 2023 Detlev Offenbach <detlev@die-offenbachs.de>.",
45 add_help=False,
46 ) 45 )
47 46
48 parser.add_argument( 47 parser.add_argument(
49 "file", 48 "file",
50 nargs="*", 49 nargs="+",
51 help="'file' can be either python modules, package directories or ordinary" 50 help="'file' can be either python modules, package directories or ordinary"
52 " directories. At least one 'file' argument must be given.", 51 " directories. At least one 'file' argument must be given.",
53 ) 52 )
54 parser.add_argument( 53 parser.add_argument(
55 "-c", 54 "-c",
72 "--exclude-file", 71 "--exclude-file",
73 action="append", 72 action="append",
74 default=[], 73 default=[],
75 help="Specify a filename pattern of files to be excluded. This option may be" 74 help="Specify a filename pattern of files to be excluded. This option may be"
76 " repeated multiple times.", 75 " repeated multiple times.",
77 )
78 parser.add_argument(
79 "-h",
80 "--help",
81 action="store_true",
82 help="Show this help and exit.",
83 ) 76 )
84 parser.add_argument( 77 parser.add_argument(
85 "-i", 78 "-i",
86 "--no-index", 79 "--no-index",
87 action="store_true", 80 action="store_true",
115 " be given multiple times.", 108 " be given multiple times.",
116 ) 109 )
117 parser.add_argument( 110 parser.add_argument(
118 "-V", 111 "-V",
119 "--version", 112 "--version",
120 action="store_true", 113 action="version",
114 version="%(prog)s {0}".format(Version),
121 help="Show version information and exit.", 115 help="Show version information and exit.",
122 ) 116 )
123 parser.add_argument( 117 parser.add_argument(
124 "-x", 118 "-x",
125 "--exclude", 119 "--exclude",
225 ) 219 )
226 220
227 return parser 221 return parser
228 222
229 223
230 def version():
231 """
232 Function to show the version information.
233 """
234 print(
235 """eric7_doc {0}\n"""
236 """\n"""
237 """eric API documentation generator.\n"""
238 """\n"""
239 """Copyright (c) 2003-2023 Detlev Offenbach"""
240 """ <detlev@die-offenbachs.de>\n"""
241 """This is free software; see LICENSE.txt for copying"""
242 """ conditions.\n"""
243 """There is NO warranty; not even for MERCHANTABILITY or FITNESS"""
244 """ FOR A\n"""
245 """PARTICULAR PURPOSE.""".format(Version)
246 )
247 sys.exit(1)
248
249
250 def main(): 224 def main():
251 """ 225 """
252 Main entry point into the application. 226 Main entry point into the application.
253 """ 227 """
254 parser = createArgumentParser() 228 parser = createArgumentParser()
255 args = parser.parse_args() 229 args = parser.parse_args()
256
257 if args.help:
258 parser.print_help()
259 sys.exit(1)
260 elif args.version:
261 version()
262 sys.exit(1)
263
264 if not args.file:
265 parser.error(
266 "At least one file, Python module, Python package or directory must be"
267 " given."
268 )
269 230
270 excludeDirs = [ 231 excludeDirs = [
271 ".svn", 232 ".svn",
272 ".hg", 233 ".hg",
273 ".git", 234 ".git",

eric ide

mercurial