npmci/ts/mod_cloudflare/index.ts

32 lines
717 B
TypeScript
Raw Normal View History

2018-04-04 20:25:13 +00:00
import * as plugins from './mod.plugins';
2017-08-27 13:24:17 +00:00
2018-04-04 20:25:13 +00:00
let npmciCflare = new plugins.cflare.CflareAccount();
2017-08-27 13:24:17 +00:00
/**
* handle cli input
* @param argvArg
*/
2018-04-04 20:25:13 +00:00
export let handleCli = async argvArg => {
2017-08-27 13:24:17 +00:00
if (argvArg._.length >= 2) {
2018-04-04 20:25:13 +00:00
let action: string = argvArg._[1];
2017-08-27 13:24:17 +00:00
switch (action) {
default:
2018-04-04 20:25:13 +00:00
plugins.beautylog.error(`>>npmci cloudflare ...<< action >>${action}<< not supported`);
process.exit(1);
2017-08-27 13:24:17 +00:00
}
} else {
2018-04-04 20:25:13 +00:00
plugins.beautylog.log(
`>>npmci cloudflare ...<< cli arguments invalid... Please read the documentation.`
);
process.exit(1);
2017-08-27 13:24:17 +00:00
}
2018-04-04 20:25:13 +00:00
};
2017-08-27 13:24:17 +00:00
2018-04-04 20:25:13 +00:00
export let purge = async argvArg => {
2017-08-27 13:24:17 +00:00
npmciCflare.auth({
email: '',
key: ''
2018-04-04 20:25:13 +00:00
});
npmciCflare.purgeZone(argvArg._[1]);
};