Files
szci/ts/szci.classes.szcicli.ts

121 lines
2.8 KiB
TypeScript
Raw Permalink Normal View History

import { logger } from './szci.logging.ts';
import * as plugins from './szci.plugins.ts';
import * as paths from './szci.paths.ts';
import { Szci } from './szci.classes.szci.ts';
2019-08-29 20:26:23 +02:00
export class SzciCli {
public szciRef: Szci;
2019-08-29 20:26:23 +02:00
public smartcli: plugins.smartcli.Smartcli;
constructor(szciArg: Szci) {
this.szciRef = szciArg;
2019-08-29 20:26:23 +02:00
this.smartcli = new plugins.smartcli.Smartcli();
this.smartcli.addVersion(this.szciRef.npmciInfo.version);
2019-08-29 20:26:23 +02:00
// clean
this.smartcli.addCommand('clean').subscribe(
2021-05-14 18:11:12 +00:00
async (argv) => {
const modClean = await import('./mod_clean/index.js');
2019-08-29 20:26:23 +02:00
await modClean.clean();
},
2021-05-14 18:11:12 +00:00
(err) => {
2019-08-29 20:26:23 +02:00
console.log(err);
Deno.exit(1);
2019-08-29 20:26:23 +02:00
}
);
2023-07-01 22:05:43 +02:00
// cloudron
this.smartcli.addCommand('cloudron').subscribe(
async (argv) => {
await this.szciRef.cloudronManager.handleCli(argv);
2023-07-01 22:05:43 +02:00
},
(err) => {
console.log(err);
Deno.exit(1);
2023-07-01 22:05:43 +02:00
}
);
2019-08-29 20:26:23 +02:00
// command
this.smartcli.addCommand('command').subscribe(
2021-05-14 18:11:12 +00:00
async (argv) => {
const modCommand = await import('./mod_command/index.js');
2019-08-29 20:26:23 +02:00
await modCommand.command();
},
2021-05-14 18:11:12 +00:00
(err) => {
2019-08-29 20:26:23 +02:00
console.log(err);
Deno.exit(1);
2019-08-29 20:26:23 +02:00
}
);
2023-07-01 22:05:43 +02:00
// git
2019-08-29 20:26:23 +02:00
this.smartcli.addCommand('git').subscribe(
2021-05-14 18:11:12 +00:00
async (argvArg) => {
await this.szciRef.gitManager.handleCli(argvArg);
2019-08-29 20:26:23 +02:00
},
2021-05-14 18:11:12 +00:00
(err) => {
2019-08-29 20:26:23 +02:00
console.log(err);
Deno.exit(1);
2019-08-29 20:26:23 +02:00
}
);
// build
this.smartcli.addCommand('docker').subscribe(
2021-05-14 18:11:12 +00:00
async (argvArg) => {
await this.szciRef.dockerManager.handleCli(argvArg);
2019-08-29 20:26:23 +02:00
},
2021-05-14 18:11:12 +00:00
(err) => {
2019-08-29 20:26:23 +02:00
console.log(err);
Deno.exit(1);
2019-08-29 20:26:23 +02:00
}
);
// node
this.smartcli.addCommand('node').subscribe(
2021-05-14 18:11:12 +00:00
async (argvArg) => {
await this.szciRef.nodejsManager.handleCli(argvArg);
2019-08-29 20:26:23 +02:00
},
2021-05-14 18:11:12 +00:00
(err) => {
2019-08-29 20:26:23 +02:00
console.log(err);
Deno.exit(1);
2019-08-29 20:26:23 +02:00
}
);
// npm
this.smartcli.addCommand('npm').subscribe(
2021-05-14 18:11:12 +00:00
async (argvArg) => {
await this.szciRef.npmManager.handleCli(argvArg);
2019-08-29 20:26:23 +02:00
},
2021-05-14 18:11:12 +00:00
(err) => {
2019-08-29 20:26:23 +02:00
console.log(err);
}
);
this.smartcli.addCommand('precheck').subscribe(async (argvArg) => {
const modPrecheck = await import('./mod_precheck/index.js');
await modPrecheck.handleCli(this.szciRef, argvArg);
2023-05-07 21:30:58 +02:00
});
2019-08-29 20:26:23 +02:00
// trigger
2023-05-07 21:30:58 +02:00
this.smartcli.addCommand('ssh').subscribe(async (argvArg) => {
const modSsh = await import('./mod_ssh/index.js');
await modSsh.handleCli(argvArg);
});
2019-08-29 20:26:23 +02:00
// trigger
this.smartcli.addCommand('trigger').subscribe(
2021-05-14 18:11:12 +00:00
async (argv) => {
const modTrigger = await import('./mod_trigger/index.js');
2019-08-29 20:26:23 +02:00
await modTrigger.trigger();
},
2021-05-14 18:11:12 +00:00
(err) => {
2019-08-29 20:26:23 +02:00
console.log(err);
Deno.exit(1);
2019-08-29 20:26:23 +02:00
}
);
}
public startParse = () => {
this.smartcli.startParse();
2019-08-29 20:38:44 +02:00
};
2019-08-29 20:26:23 +02:00
}