@ethersphere/swarm-cli
Version:
CLI tool for Bee
30 lines (22 loc) • 858 B
text/typescript
import { MantarayNode } from '@ethersphere/bee-js'
import { Optional } from 'cafe-utility'
import { LeafCommand, Option } from 'furious-commander'
import { pickStamp } from '../../service/stamp'
import { stampProperties } from '../../utils/option'
import { RootCommand } from '../root-command'
export class Create extends RootCommand implements LeafCommand {
public readonly name = 'create'
public readonly description = 'Create an empty manifest'
(stampProperties)
public stamp!: string
public async run(): Promise<void> {
super.init()
if (!this.stamp) {
this.stamp = await pickStamp(this.bee, this.console)
}
const node = new MantarayNode()
const result = await node.saveRecursively(this.bee, this.stamp)
this.result = Optional.of(result.reference)
this.console.log(result.reference.toHex())
}
}