Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit 604473c

Browse files
committed
Print newline by default
1 parent 926ca6b commit 604473c

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

packages/cli/src/action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function printPretty(result: any, args: CliArguments) {
1313

1414
function printJson(result: any) {
1515
const json = JSON.stringify(result)
16-
print(json)
16+
print(json, false)
1717
}
1818

1919
export default async function action(args: CliArguments) {

packages/cli/src/util.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
function write(stream: NodeJS.WriteStream, data: any) {
1+
function write(stream: NodeJS.WriteStream, data: any, newline: boolean) {
22
stream.write(data)
3+
if (newline) {
4+
stream.write('\n')
5+
}
36
}
47

5-
export function print(data: any) {
6-
write(process.stdout, data)
8+
export function print(data: any, newline = true) {
9+
write(process.stdout, data, newline)
710
}
811

9-
export function printError(data: any) {
10-
write(process.stderr, data)
12+
export function printError(data: any, newline = true) {
13+
write(process.stderr, data, newline)
1114
}

0 commit comments

Comments
 (0)