Command line option to print out List of SimObjects and their parameters
This commit is contained in:
parent
bbeb8082a5
commit
b2036bfda8
1 changed files with 26 additions and 0 deletions
|
@ -116,6 +116,11 @@ add_option("--trace-file", metavar="FILE", default="cout",
|
|||
add_option("--trace-ignore", metavar="EXPR", action='append', split=':',
|
||||
help="Ignore EXPR sim objects")
|
||||
|
||||
# Help options
|
||||
set_group("Help Options")
|
||||
add_option("--list-sim-objects", action='store_true', default=False,
|
||||
help="List all built-in SimObjects, their parameters and default values")
|
||||
|
||||
def main():
|
||||
import defines
|
||||
import event
|
||||
|
@ -187,6 +192,27 @@ def main():
|
|||
print_list(traceflags.compoundFlagMap[flag], indent=8)
|
||||
print
|
||||
|
||||
if options.list_sim_objects:
|
||||
import SimObject
|
||||
done = True
|
||||
print "SimObjects:"
|
||||
objects = SimObject.allClasses.keys()
|
||||
objects.sort()
|
||||
for name in objects:
|
||||
obj = SimObject.allClasses[name]
|
||||
print " %s" % obj
|
||||
params = obj._params.keys()
|
||||
params.sort()
|
||||
for pname in params:
|
||||
param = obj._params[pname]
|
||||
default = getattr(param, 'default', '')
|
||||
print " %s" % pname
|
||||
if default:
|
||||
print " default: %s" % default
|
||||
print " desc: %s" % param.desc
|
||||
print
|
||||
print
|
||||
|
||||
if done:
|
||||
sys.exit(0)
|
||||
|
||||
|
|
Loading…
Reference in a new issue