Skip to content

Commit b5d5a7a

Browse files
authored
status command returns json (#5215)
1 parent 4129785 commit b5d5a7a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ironfish-cli/src/commands/status.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ import {
1212
import { Flags } from '@oclif/core'
1313
import blessed from 'blessed'
1414
import { IronfishCommand } from '../command'
15-
import { RemoteFlags } from '../flags'
15+
import { JsonFlags, RemoteFlags } from '../flags'
1616
import * as ui from '../ui'
1717

1818
export default class Status extends IronfishCommand {
1919
static description = "show the node's status"
20+
static enableJsonFlag = true
2021

2122
static flags = {
2223
...RemoteFlags,
24+
...JsonFlags,
2325
follow: Flags.boolean({
2426
char: 'f',
2527
default: false,
@@ -31,14 +33,15 @@ export default class Status extends IronfishCommand {
3133
}),
3234
}
3335

34-
async start(): Promise<void> {
36+
async start(): Promise<unknown> {
3537
const { flags } = await this.parse(Status)
3638

3739
if (!flags.follow) {
3840
const client = await this.connectRpc()
3941
const response = await client.node.getStatus()
4042
this.log(renderStatus(response.content, flags.all))
41-
this.exit(0)
43+
44+
return response.content
4245
}
4346

4447
// Console log will create display issues with Blessed
@@ -219,7 +222,7 @@ function renderStatus(content: GetNodeStatusResponse, debugOutput: boolean): str
219222
Version: `${content.node.version} @ ${content.node.git}`,
220223
Node: nodeStatus,
221224
'Node Name': content.node.nodeName,
222-
'Peed ID': content.peerNetwork.publicIdentity,
225+
'Peer ID': content.peerNetwork.publicIdentity,
223226
'Block Graffiti': blockGraffiti,
224227
Network: network,
225228
Memory: memoryStatus,

0 commit comments

Comments
 (0)