diff --git a/src/command/manifest/index.ts b/src/command/manifest/index.ts index 6d940ae6..9fe617a5 100644 --- a/src/command/manifest/index.ts +++ b/src/command/manifest/index.ts @@ -1,10 +1,15 @@ import { GroupCommand } from 'furious-commander' +import { Add } from './add' +import { Create } from './create' import { Download } from './download' import { List } from './list' +import { Merge } from './merge' +import { Remove } from './remove' +import { Sync } from './sync' export class Manifest implements GroupCommand { public readonly name = 'manifest' public readonly description = 'Operate on manifests' - public subCommandClasses = [Download, List] + public subCommandClasses = [Add, Create, Download, List, Merge, Remove, Sync] } diff --git a/src/command/manifest/remove.ts b/src/command/manifest/remove.ts index 4ccae03a..302bc1a2 100644 --- a/src/command/manifest/remove.ts +++ b/src/command/manifest/remove.ts @@ -26,9 +26,27 @@ export class Remove extends ManifestCommand implements LeafCommand { const forks = this.findAllValueForks(node) for (const fork of forks) { if (fork.path === address.path || fork.path.startsWith(address.path + '/')) { + const childPaths = this.findAllValueForks(fork.node).map(({ path }) => fork.path + path) + + if (childPaths.length > 0) { + const confirmed = await this.promptAdditionalFileDelete(fork.path, childPaths) + + if (!confirmed) { + continue + } + } + node.removePath(this.encodePath(fork.path)) } } await this.saveAndPrintNode(node, this.stamp) } + + protected promptAdditionalFileDelete(mainPath: string, paths: string[]): Promise { + return this.console.confirmAndDelete( + `Deleting the ${mainPath} will result in deletion of the additional resources: \n\t${paths.join( + '\n\t', + )}\nContinue?`, + ) + } }