Skip to content

Commit 74239df

Browse files
authored
update rpc descriptions, add json output (#5244)
1 parent bed1b3c commit 74239df

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

ironfish-cli/src/commands/rpc/status.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,32 @@ import { FileUtils, GetRpcStatusResponse, PromiseUtils } from '@ironfish/sdk'
55
import { Flags } from '@oclif/core'
66
import blessed from 'blessed'
77
import { IronfishCommand } from '../../command'
8-
import { RemoteFlags } from '../../flags'
8+
import { JsonFlags, RemoteFlags } from '../../flags'
99
import * as ui from '../../ui'
1010

1111
export default class Status extends IronfishCommand {
12-
static description = 'show RPC server information'
12+
static description = "show RPC server's status"
13+
static enableJsonFlag = true
1314

1415
static flags = {
1516
...RemoteFlags,
17+
...JsonFlags,
1618
follow: Flags.boolean({
1719
char: 'f',
1820
default: false,
1921
description: 'Follow the status of the node live',
2022
}),
2123
}
2224

23-
async start(): Promise<void> {
25+
async start(): Promise<unknown> {
2426
const { flags } = await this.parse(Status)
2527

2628
if (!flags.follow) {
2729
const client = await this.connectRpc()
2830
const response = await client.rpc.getRpcStatus()
2931
this.log(renderStatus(response.content))
30-
this.exit(0)
32+
33+
return response.content
3134
}
3235

3336
// Console log will create display issues with Blessed

ironfish-cli/src/commands/rpc/token.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44
import { Flags } from '@oclif/core'
55
import { IronfishCommand } from '../../command'
6+
import { JsonFlags } from '../../flags'
67

78
export default class Token extends IronfishCommand {
8-
static description = 'Get or set the RPC auth token'
9+
static description = 'get or set the RPC auth token'
10+
static enableJsonFlag = true
911

1012
static flags = {
13+
...JsonFlags,
1114
token: Flags.string({
1215
required: false,
1316
description: 'Set the RPC auth token to <value>',
1417
}),
1518
}
1619

17-
async start(): Promise<void> {
20+
async start(): Promise<unknown> {
1821
const { flags } = await this.parse(Token)
1922

2023
const internal = this.sdk.internal
@@ -33,5 +36,7 @@ export default class Token extends IronfishCommand {
3336
this.log('No RPC auth token found.')
3437
}
3538
}
39+
40+
return { rpcAuthToken: token }
3641
}
3742
}

0 commit comments

Comments
 (0)