1
2 """
3 Application class that implements pyFoamEchoDictionary
4 """
5
6 import sys,re
7
8 from PyFoamApplication import PyFoamApplication
9
10 from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile
11
12 from CommonParserOptions import CommonParserOptions
13
17 description="""
18 Reads a Foam-Dictionary and prints it to the screen. Mainly for reformatting
19 unformated dictionaries and debugging the parser
20 """
21
22 PyFoamApplication.__init__(self,
23 args=args,
24 description=description,
25 usage="%prog [options] <dictfile>",
26 nr=1,
27 changeVersion=False,
28 interspersed=True)
29
32
34 fName=self.parser.getArgs()[0]
35 try:
36 dictFile=ParsedParameterFile(fName,
37 backup=False,
38 debug=self.opts.debugParser,
39 noHeader=self.opts.noHeader,
40 noBody=self.opts.noBody,
41 boundaryDict=self.opts.boundaryDict,
42 listDict=self.opts.listDict,
43 listDictWithHeader=self.opts.listDictWithHeader,
44 doMacroExpansion=self.opts.doMacros)
45 except IOError,e:
46 self.error("Problem with file",fName,":",e)
47
48 print dictFile
49