mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 02:39:49 +00:00
Fix debug message logic (don't suggest --debug if it is already being used)
Change-type: patch
This commit is contained in:
parent
65f053dd6e
commit
a4fd7d6118
@ -224,7 +224,7 @@ export const printErrorMessage = function (message: string) {
|
||||
console.error(line);
|
||||
});
|
||||
|
||||
console.error(`\n${getHelp}\n`);
|
||||
console.error(`\n${getHelp()}\n`);
|
||||
};
|
||||
|
||||
export const printExpectedErrorMessage = function (message: string) {
|
||||
|
@ -15,8 +15,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const DEBUG_MODE = !!process.env.DEBUG;
|
||||
|
||||
export const reachingOut = `\
|
||||
If you need help, or just want to say hi, don't hesitate in reaching out
|
||||
through our discussion and support forums at https://forums.balena.io
|
||||
@ -27,14 +25,16 @@ create a new one at: https://github.com/balena-io/balena-cli/issues/\
|
||||
|
||||
const debugHint = `\
|
||||
Additional information may be available with the \`--debug\` flag.
|
||||
`;
|
||||
\n`;
|
||||
|
||||
export const help = `\
|
||||
For help, visit our support forums: https://forums.balena.io
|
||||
For bug reports or feature requests, see: https://github.com/balena-io/balena-cli/issues/
|
||||
`;
|
||||
|
||||
export const getHelp = (DEBUG_MODE ? '' : debugHint) + help;
|
||||
// Note that the value of process.env.DEBUG may change after the --debug flag
|
||||
// is parsed, so its evaluation cannot happen at module loading time.
|
||||
export const getHelp = () => (process.env.DEBUG ? '' : debugHint) + help;
|
||||
|
||||
export const balenaAsciiArt = `\
|
||||
_ _
|
||||
|
@ -187,7 +187,7 @@ describe('printErrorMessage() function', () => {
|
||||
expect(consoleError.getCall(0).args[0]).to.equal(expectedOutputMessages[0]);
|
||||
expect(consoleError.getCall(1).args[0]).to.equal(expectedOutputMessages[1]);
|
||||
expect(consoleError.getCall(2).args[0]).to.equal(expectedOutputMessages[2]);
|
||||
expect(consoleError.getCall(3).args[0]).to.equal(`\n${getHelp}\n`);
|
||||
expect(consoleError.getCall(3).args[0]).to.equal(`\n${getHelp()}\n`);
|
||||
|
||||
consoleError.restore();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user