Skip to content

Commit 3d4562b

Browse files
committed
feat: add wrap to allocation commands
Signed-off-by: Tomás Migone <[email protected]>
1 parent 325d6fa commit 3d4562b

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

packages/indexer-cli/src/commands/indexer/allocations/close.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ${chalk.dim('Options:')}
2121
-n, --network <network> The network to close the allocation on: mainnet, arbitrum-one, sepolia or arbitrum sepolia
2222
-f, --force Bypass POI accuracy checks and submit transaction with provided data
2323
-o, --output table|json|yaml Choose the output format: table (default), JSON, or YAML
24+
-w, --wrap [N] Wrap the output to a specific width (default: 0, no wrapping)
2425
2526
${chalk.dim('Arguments:')}
2627
<id> The allocation id to close
@@ -38,11 +39,12 @@ module.exports = {
3839

3940
const spinner = toolbox.print.spin('Processing inputs')
4041

41-
const { h, help, f, force, o, output } = parameters.options
42+
const { h, help, f, force, o, output, w, wrap } = parameters.options
4243

4344
const outputFormat = o || output || 'table'
4445
const toHelp = help || h || undefined
4546
const toForce = force || f || false
47+
const wrapWidth = w || wrap || 0
4648

4749
if (toHelp) {
4850
spinner.stopAndPersist({ symbol: '💁', text: HELP })
@@ -106,7 +108,7 @@ module.exports = {
106108
'allocation',
107109
'allocatedTokens',
108110
'indexingRewards',
109-
])
111+
], wrapWidth)
110112
} catch (error) {
111113
spinner.fail(error.toString())
112114
process.exitCode = 1

packages/indexer-cli/src/commands/indexer/allocations/create.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ${chalk.dim('Options:')}
2020
-h, --help Show usage information
2121
-n, --network <network> The protocol network for this action (mainnet, arbitrum-one, sepolia, arbitrum-sepolia)
2222
-o, --output table|json|yaml Choose the output format: table (default), JSON, or YAML
23+
-w, --wrap [N] Wrap the output to a specific width (default: 0, no wrapping)
2324
`
2425

2526
module.exports = {
@@ -31,10 +32,11 @@ module.exports = {
3132

3233
const spinner = toolbox.print.spin('Processing inputs')
3334

34-
const { h, help, o, output } = parameters.options
35+
const { h, help, o, output, w, wrap } = parameters.options
3536

3637
const outputFormat = o || output || 'table'
3738
const toHelp = help || h || undefined
39+
const wrapWidth = w || wrap || 0
3840

3941
if (toHelp) {
4042
spinner.stopAndPersist({ symbol: '💁', text: HELP })
@@ -88,7 +90,7 @@ module.exports = {
8890
'deployment',
8991
'allocatedTokens',
9092
'protocolNetwork',
91-
])
93+
], wrapWidth)
9294
} catch (error) {
9395
spinner.fail(error.toString())
9496
process.exitCode = 1

packages/indexer-cli/src/commands/indexer/allocations/get.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ${chalk.dim('Options:')}
2222
--status active|closed|claimable Filter by status
2323
--deployment <id> Fetch only allocations for a specific subgraph deployment
2424
-o, --output table|json|yaml Choose the output format: table (default), JSON, or YAML
25+
-w, --wrap [N] Wrap the output to a specific width (default: 0, no wrapping)
2526
`
2627

2728
module.exports = {
@@ -33,10 +34,11 @@ module.exports = {
3334

3435
const spinner = toolbox.print.spin('Processing inputs')
3536

36-
const { status, deployment, h, help, o, output } = parameters.options
37+
const { status, deployment, h, help, o, output, w, wrap } = parameters.options
3738

3839
const [allocation] = fixParameters(parameters, { h, help }) || []
3940
const outputFormat = o || output || 'table'
41+
const wrapWidth = w || wrap || 0
4042

4143
if (help || h) {
4244
spinner.stopAndPersist({ symbol: '💁', text: HELP })
@@ -169,7 +171,7 @@ module.exports = {
169171
)
170172
}
171173
spinner.succeed('Allocations')
172-
printIndexerAllocations(print, outputFormat, allocations, displayProperties)
174+
printIndexerAllocations(print, outputFormat, allocations, displayProperties, wrapWidth)
173175
} catch (error) {
174176
spinner.fail(error.toString())
175177
process.exitCode = 1

packages/indexer-cli/src/commands/indexer/allocations/reallocate.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ${chalk.dim('Options:')}
2020
-h, --help Show usage information
2121
-n, --network <network> The protocol network for this action (mainnet, arbitrum-one, sepolia, arbitrum-sepolia)
2222
-f, --force Bypass POI accuracy checks and submit transaction with provided data
23+
-w, --wrap [N] Wrap the output to a specific width (default: 0, no wrapping)
2324
2425
${chalk.dim('Arguments:')}
2526
<id> The allocation id to close
@@ -38,11 +39,12 @@ module.exports = {
3839

3940
const spinner = toolbox.print.spin('Processing inputs')
4041

41-
const { h, help, f, force, o, output } = parameters.options
42+
const { h, help, f, force, o, output, w, wrap } = parameters.options
4243

4344
const outputFormat = o || output || 'table'
4445
const toHelp = help || h || undefined
4546
const toForce = force || f || false
47+
const wrapWidth = w || wrap || 0
4648

4749
if (toHelp) {
4850
spinner.stopAndPersist({ symbol: '💁', text: HELP })
@@ -110,6 +112,7 @@ module.exports = {
110112
'createdAllocation',
111113
'createdAllocationStake',
112114
],
115+
wrapWidth,
113116
)
114117
} catch (error) {
115118
spinner.fail(error.toString())

0 commit comments

Comments
 (0)