app: move some code around
Moving all the "work" of main() into WestApp.run() will help us in future patches where we need to set up logging in a way that requires internal state from that object. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
4736156a0d
commit
951fa7e315
|
@ -85,6 +85,15 @@ class WestApp:
|
||||||
def run(self, argv):
|
def run(self, argv):
|
||||||
# Run the command-line application with argument list 'argv'.
|
# Run the command-line application with argument list 'argv'.
|
||||||
|
|
||||||
|
# Silence validation errors from pykwalify, which are logged at
|
||||||
|
# logging.ERROR level. We want to handle those ourselves as
|
||||||
|
# needed.
|
||||||
|
logging.getLogger('pykwalify').setLevel(logging.CRITICAL)
|
||||||
|
|
||||||
|
# Makes ANSI color escapes work on Windows, and strips them when
|
||||||
|
# stdout/stderr isn't a terminal
|
||||||
|
colorama.init()
|
||||||
|
|
||||||
# See if we're in a workspace. It's fine if we're not.
|
# See if we're in a workspace. It's fine if we're not.
|
||||||
# Note that this falls back on searching from ZEPHYR_BASE
|
# Note that this falls back on searching from ZEPHYR_BASE
|
||||||
# if the current directory isn't inside a west workspace.
|
# if the current directory isn't inside a west workspace.
|
||||||
|
@ -910,15 +919,6 @@ def dump_traceback():
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
# Silence validation errors from pykwalify, which are logged at
|
|
||||||
# logging.ERROR level. We want to handle those ourselves as
|
|
||||||
# needed.
|
|
||||||
logging.getLogger('pykwalify').setLevel(logging.CRITICAL)
|
|
||||||
|
|
||||||
# Makes ANSI color escapes work on Windows, and strips them when
|
|
||||||
# stdout/stderr isn't a terminal
|
|
||||||
colorama.init()
|
|
||||||
|
|
||||||
# Create the WestApp instance and let it run.
|
# Create the WestApp instance and let it run.
|
||||||
app = WestApp()
|
app = WestApp()
|
||||||
app.run(argv or sys.argv[1:])
|
app.run(argv or sys.argv[1:])
|
||||||
|
|
Loading…
Reference in New Issue