Skip to content

Commit 2f51b85

Browse files
authored
chore: change chunk to root chunk (#411)
* chore: reword pinning * chore: change chunk to root chunk * refactor: use string template instead of concat * test: fix regex pattern
1 parent 2f8eb13 commit 2f51b85

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/command/pinning/list.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import chalk from 'chalk'
12
import { LeafCommand } from 'furious-commander'
23
import { PinningCommand } from './pinning-command'
34

@@ -6,21 +7,20 @@ export class List extends PinningCommand implements LeafCommand {
67

78
public readonly alias = 'ls'
89

9-
public readonly description = 'List pinned chunks'
10+
public readonly description = 'List pinned root hashes'
1011

1112
public async run(): Promise<void> {
1213
await super.init()
14+
this.console.info('Getting pinned root hashes...')
1315

14-
this.console.info('Getting pinned chunks...')
16+
const pins = await this.bee.getAllPins()
1517

16-
const chunks = await this.bee.getAllPins()
18+
this.console.log(chalk.bold(`Found ${pins.length} pinned root hashes`))
19+
this.console.log('')
1720

18-
this.console.log(`Found ${chunks.length} pinned chunks`)
19-
this.console.divider()
20-
21-
for (const chunk of chunks) {
22-
this.console.log(` - ${chunk}`)
23-
this.console.quiet(chunk)
21+
for (const pin of pins) {
22+
this.console.log(pin)
23+
this.console.quiet(pin)
2424
}
2525
}
2626
}

src/command/pinning/reupload-all.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class ReuploadAll extends PinningCommand implements LeafCommand {
1414
const total = chunks.length
1515
let successful = 0
1616

17-
this.console.log('Found ' + total + ' chunks to reupload...')
17+
this.console.log(`Found ${total} root chunks to reupload...`)
1818

1919
for (const chunk of chunks) {
2020
try {
@@ -26,7 +26,7 @@ export class ReuploadAll extends PinningCommand implements LeafCommand {
2626
}
2727
}
2828

29-
this.console.log('Reuploaded ' + successful + ' out of ' + total + ' pinned chunks')
29+
this.console.log(`Reuploaded ${successful} out of ${total} pinned root chunks`)
3030
this.console.quiet(successful + '/' + total)
3131
}
3232

test/command/pinning.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describeCommand(
9595

9696
it('should reupload all pinned content', async () => {
9797
await invokeTestCli(['pinning', 'reupload-all'])
98-
expect(getLastMessage()).toMatch(/Reuploaded \d+ out of \d+ pinned chunks/)
98+
expect(getLastMessage()).toMatch(/Reuploaded \d+ out of \d+ pinned root chunks/)
9999
})
100100
},
101101
{ configFileName: 'pinning' },

0 commit comments

Comments
 (0)