Skip to content

Commit 92ed243

Browse files
authored
fix streamed csv output for wallet:transactions (#5605)
this was printing the headers for every line because it was not checking the no-headers table option
1 parent 56dfee2 commit 92ed243

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

ironfish-cli/src/commands/wallet/transactions.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import {
1313
import { Flags } from '@oclif/core'
1414
import { IronfishCommand } from '../../command'
1515
import { RemoteFlags } from '../../flags'
16-
import { checkWalletUnlocked, table, TableColumns, TableFlags } from '../../ui'
16+
import * as ui from '../../ui'
1717
import { getAssetsByIDs, useAccount } from '../../utils'
1818
import { extractChainportDataFromTransaction } from '../../utils/chainport'
1919
import { Format, TableCols } from '../../utils/table'
2020

21-
const { sort: _, ...tableFlags } = TableFlags
21+
const { sort: _, ...tableFlags } = ui.TableFlags
2222
export class TransactionsCommand extends IronfishCommand {
2323
static description = `list the account's transactions`
2424

@@ -64,7 +64,7 @@ export class TransactionsCommand extends IronfishCommand {
6464
: Format.cli
6565

6666
const client = await this.connectRpc()
67-
await checkWalletUnlocked(client)
67+
await ui.checkWalletUnlocked(client)
6868

6969
const account = await useAccount(client, flags.account)
7070

@@ -114,7 +114,7 @@ export class TransactionsCommand extends IronfishCommand {
114114
transactionRows = this.getTransactionRows(assetLookup, transaction, format)
115115
}
116116

117-
table(transactionRows, columns, {
117+
ui.table(transactionRows, columns, {
118118
printLine: this.log.bind(this),
119119
...flags,
120120
'no-header': !showHeader,
@@ -254,8 +254,8 @@ export class TransactionsCommand extends IronfishCommand {
254254
extended: boolean,
255255
notes: boolean,
256256
format: Format,
257-
): TableColumns<PartialRecursive<TransactionRow>> {
258-
let columns: TableColumns<PartialRecursive<TransactionRow>> = {
257+
): ui.TableColumns<PartialRecursive<TransactionRow>> {
258+
let columns: ui.TableColumns<PartialRecursive<TransactionRow>> = {
259259
timestamp: TableCols.timestamp({
260260
streaming: true,
261261
}),

ironfish-cli/src/ui/table.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ class Table<T extends Record<string, unknown>> {
146146
}
147147
columnHeaders.push(sanitizeCsvValue(column.header))
148148
}
149-
this.options.printLine(columnHeaders.join(','))
149+
if (!this.options['no-header']) {
150+
this.options.printLine(columnHeaders.join(','))
151+
}
150152

151153
for (const row of rows) {
152154
const rowValues = []

0 commit comments

Comments
 (0)