-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bdk): bdk quorum cluster delete network
- Loading branch information
1 parent
b9588e2
commit a1cb771
Showing
8 changed files
with
110 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Argv } from 'yargs' | ||
import config from '../../config' | ||
import Cluster from '../../service/cluster' | ||
import { onCancel } from '../../../util/error' | ||
import prompts from 'prompts' | ||
import ora from 'ora' | ||
|
||
export const command = 'delete' | ||
|
||
export const desc = '刪除現有的 Quorum Cluster 網路' | ||
|
||
interface OptType { | ||
interactive: boolean | ||
} | ||
|
||
export const builder = (yargs: Argv<OptType>) => { | ||
return yargs | ||
.example('bdk quorum cluster delete --interactive', 'Cathay BDK 互動式問答') | ||
.option('interactive', { type: 'boolean', description: '是否使用 Cathay BDK 互動式問答', alias: 'i' }) | ||
} | ||
|
||
export const handler = async () => { | ||
const cluster = new Cluster(config) | ||
|
||
const confirm: boolean = await (async () => { | ||
const fileList = cluster.getHelmChartFiles() | ||
if (fileList.length !== 0) { | ||
const confirmDelete = (await prompts({ | ||
type: 'confirm', | ||
name: 'value', | ||
message: '⚠️ Detecting quorum nodes already exists. The following processes will remove all existing files. Continue?', | ||
initial: false, | ||
}, { onCancel })).value | ||
if (confirmDelete) { | ||
const spinner = ora('Quorum Network Create ...').start() | ||
cluster.removeHelmChartFiles() | ||
spinner.succeed('Remove all existing files!') | ||
} | ||
return confirmDelete | ||
} else { | ||
return true | ||
} | ||
})() | ||
|
||
if (confirm) { | ||
const spinner = ora('Deployments Under Namespace Quorum Delete ...').start() | ||
await cluster.delete() | ||
spinner.succeed('Quorum Cluster Delete Successfully!') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters