MCPcopy Create free account
hub / github.com/daniel2005d/mapXplore / do_set

Method do_set

console/modules/configCommand.py:74–93  ·  view source on GitHub ↗
(self, args:cmd2.Statement)

Source from the content-addressed store, hash-verified

72 return completions
73
74 def do_set(self, args:cmd2.Statement):
75 try:
76 section, option, value = None, None, None
77 if self._section is not None:
78 section = self._section
79 option = args.arg_list[0]
80 value = args.arg_list[1] if args.command == 'set' else None
81 else:
82 section = args.arg_list[0]
83 option = args.arg_list[1]
84 value = args.arg_list[2] if len(args.arg_list)>2 else None
85 if args.command == 'unset':
86 Settings.set_value(section, option, None)
87 elif args.command == 'set':
88 if section if self._section != section else option in self._config:
89 Settings.set_value(section, option, value)
90 else:
91 AnsiPrint.print_error(locale.get("errors.section_config_error").format(section=section))
92 except Exception as e:
93 AnsiPrint.print_error(e)
94
95
96 def do_show(self, arg:cmd2.Statement):

Callers 1

do_unsetMethod · 0.95

Calls 3

set_valueMethod · 0.45
print_errorMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected