121 lines
2.8 KiB
TypeScript
121 lines
2.8 KiB
TypeScript
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';
|
|
|
|
export class SzciCli {
|
|
public szciRef: Szci;
|
|
public smartcli: plugins.smartcli.Smartcli;
|
|
|
|
constructor(szciArg: Szci) {
|
|
this.szciRef = szciArg;
|
|
this.smartcli = new plugins.smartcli.Smartcli();
|
|
this.smartcli.addVersion(this.szciRef.npmciInfo.version);
|
|
|
|
// clean
|
|
this.smartcli.addCommand('clean').subscribe(
|
|
async (argv) => {
|
|
const modClean = await import('./mod_clean/index.js');
|
|
await modClean.clean();
|
|
},
|
|
(err) => {
|
|
console.log(err);
|
|
Deno.exit(1);
|
|
}
|
|
);
|
|
|
|
// cloudron
|
|
this.smartcli.addCommand('cloudron').subscribe(
|
|
async (argv) => {
|
|
await this.szciRef.cloudronManager.handleCli(argv);
|
|
},
|
|
(err) => {
|
|
console.log(err);
|
|
Deno.exit(1);
|
|
}
|
|
);
|
|
|
|
// command
|
|
this.smartcli.addCommand('command').subscribe(
|
|
async (argv) => {
|
|
const modCommand = await import('./mod_command/index.js');
|
|
await modCommand.command();
|
|
},
|
|
(err) => {
|
|
console.log(err);
|
|
Deno.exit(1);
|
|
}
|
|
);
|
|
|
|
// git
|
|
this.smartcli.addCommand('git').subscribe(
|
|
async (argvArg) => {
|
|
await this.szciRef.gitManager.handleCli(argvArg);
|
|
},
|
|
(err) => {
|
|
console.log(err);
|
|
Deno.exit(1);
|
|
}
|
|
);
|
|
|
|
// build
|
|
this.smartcli.addCommand('docker').subscribe(
|
|
async (argvArg) => {
|
|
await this.szciRef.dockerManager.handleCli(argvArg);
|
|
},
|
|
(err) => {
|
|
console.log(err);
|
|
Deno.exit(1);
|
|
}
|
|
);
|
|
|
|
// node
|
|
this.smartcli.addCommand('node').subscribe(
|
|
async (argvArg) => {
|
|
await this.szciRef.nodejsManager.handleCli(argvArg);
|
|
},
|
|
(err) => {
|
|
console.log(err);
|
|
Deno.exit(1);
|
|
}
|
|
);
|
|
|
|
// npm
|
|
this.smartcli.addCommand('npm').subscribe(
|
|
async (argvArg) => {
|
|
await this.szciRef.npmManager.handleCli(argvArg);
|
|
},
|
|
(err) => {
|
|
console.log(err);
|
|
}
|
|
);
|
|
|
|
this.smartcli.addCommand('precheck').subscribe(async (argvArg) => {
|
|
const modPrecheck = await import('./mod_precheck/index.js');
|
|
await modPrecheck.handleCli(this.szciRef, argvArg);
|
|
});
|
|
|
|
// trigger
|
|
this.smartcli.addCommand('ssh').subscribe(async (argvArg) => {
|
|
const modSsh = await import('./mod_ssh/index.js');
|
|
await modSsh.handleCli(argvArg);
|
|
});
|
|
|
|
// trigger
|
|
this.smartcli.addCommand('trigger').subscribe(
|
|
async (argv) => {
|
|
const modTrigger = await import('./mod_trigger/index.js');
|
|
await modTrigger.trigger();
|
|
},
|
|
(err) => {
|
|
console.log(err);
|
|
Deno.exit(1);
|
|
}
|
|
);
|
|
}
|
|
|
|
public startParse = () => {
|
|
this.smartcli.startParse();
|
|
};
|
|
}
|