Add support for global --debug flag

Change-type: patch
Resolves: 
Signed-off-by: Scott Lowe <scott@balena.io>
This commit is contained in:
Scott Lowe 2020-04-29 12:58:52 +02:00
parent ad0b667bc7
commit db247307db

@ -52,6 +52,13 @@ export async function routeCliFramework(argv: string[], options: AppOptions) {
cmdSlice.shift();
cmdSlice.push('--help');
}
// support global --debug flag
const debugIndex = cmdSlice.indexOf('--debug');
if (debugIndex > -1) {
process.env.DEBUG = '1';
cmdSlice.splice(debugIndex, 1);
}
}
const [isOclif, isTopic] = isOclifCommand(cmdSlice);