1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const help_1 = require("../help");
|
4 | class RemoveCommand {
|
5 | constructor(config) {
|
6 | this.reponame = '';
|
7 | this.config = config;
|
8 | }
|
9 | execute(params) {
|
10 | this.config.removeRepo(this.reponame);
|
11 | this.config.data.current = '';
|
12 | console.log(this.reponame);
|
13 | }
|
14 | validate(params) {
|
15 | const options = params['options'];
|
16 | if (options['help'] === true) {
|
17 | const help = new help_1.Help();
|
18 | help.removeCommand();
|
19 | process.exit(0);
|
20 | }
|
21 | const reponame = options['name'];
|
22 | if (reponame === undefined) {
|
23 | console.error('Error: a repo name should be provided');
|
24 | return false;
|
25 | }
|
26 | if (!this.config.repoExists(reponame)) {
|
27 | console.error(`Error: repo '${reponame}' does not exist`);
|
28 | return false;
|
29 | }
|
30 | this.reponame = reponame;
|
31 | return true;
|
32 | }
|
33 | }
|
34 | exports.RemoveCommand = RemoveCommand;
|
35 |
|
\ | No newline at end of file |