@ethersphere/swarm-cli
Version:
CLI tool for Bee
41 lines (32 loc) • 1.14 kB
text/typescript
import { Argument, LeafCommand, Option } from 'furious-commander'
import { pickStamp } from '../../service/stamp'
import { stampProperties } from '../../utils/option'
import { PinningCommand } from './pinning-command'
export class Reupload extends PinningCommand implements LeafCommand {
// CLI FIELDS
public readonly name = 'reupload'
public readonly description = 'Reupload locally pinned content'
public address!: string
public stamp!: string
public async run(): Promise<void> {
await super.init()
if (!this.stamp) {
this.stamp = await pickStamp(this.bee, this.console)
}
this.console.log('Reuploading ' + this.address + '...')
try {
await this.bee.reuploadPinnedData(this.stamp, this.address)
this.console.log('Reuploaded successfully.')
} catch (error) {
this.console.printBeeError(error, { notFoundMessage: 'No locally pinned content found with that address.' })
}
}
}