Skip to content

Commit 655d2a4

Browse files
committed
Disable banner by default, for now
1 parent 9efd7c0 commit 655d2a4

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/utils/meow-with-subcommands.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { getSetting } from './settings.ts'
77
import { MeowFlags, commonFlags } from '../flags'
88

99
import type { Options } from 'meow'
10+
import { envAsBoolean } from '@socketsecurity/registry/lib/env'
1011

1112
interface CliAlias {
1213
description: string
@@ -87,7 +88,10 @@ export async function meowWithSubcommands(
8788
}
8889
// ...else we provide basic instructions and help
8990

90-
console.log(getAsciiHeader(name))
91+
// Temp disable until we clear the --json and --markdown usage
92+
if (envAsBoolean(process.env['SOCKET_CLI_SHOW_BANNER'])) {
93+
console.log(getAsciiHeader(name))
94+
}
9195

9296
const cli = meow(
9397
`
@@ -160,7 +164,10 @@ export function meowOrExit({
160164

161165
const help = config.help(command, config)
162166

163-
console.log(getAsciiHeader(command))
167+
// Temp disable until we clear the --json and --markdown usage
168+
if (envAsBoolean(process.env['SOCKET_CLI_SHOW_BANNER'])) {
169+
console.log(getAsciiHeader(command))
170+
}
164171

165172
// This exits if .printHelp() is called either by meow itself or by us.
166173
const cli = meow({

test/dry-run.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
import path from 'node:path'
1212

1313
import spawn from '@npmcli/promise-spawn'
14-
import { describe, expect, it } from 'vitest'
14+
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
1515

1616
import constants from '../dist/constants.js'
17+
import { envAsBoolean } from '@socketsecurity/registry/lib/env'
1718

1819
type PromiseSpawnOptions = Exclude<Parameters<typeof spawn>[2], undefined> & {
1920
encoding?: BufferEncoding | undefined
@@ -43,6 +44,22 @@ function cmdit(
4344
}
4445

4546
describe('dry-run on all commands', async () => {
47+
let was: unknown
48+
49+
beforeAll(() => {
50+
// Temp: we have to disable the banner by default until we make it work
51+
// properly with --json and --markdown, since otherwise the output
52+
// would be invalid.
53+
was = process.env['SOCKET_CLI_SHOW_BANNER']
54+
process.env['SOCKET_CLI_SHOW_BANNER'] = '1'
55+
})
56+
57+
afterAll(() => {
58+
if (was) {
59+
process.env['SOCKET_CLI_SHOW_BANNER'] = was as any
60+
}
61+
})
62+
4663
// Lazily access constants.rootBinPath.
4764
const entryPath = path.join(constants.rootBinPath, `${CLI}.js`)
4865

0 commit comments

Comments
 (0)