mirror of
https://github.com/sern-handler/cli
synced 2026-06-06 01:16:53 +00:00
chore: use constant instead of function
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { cyanBright, green, magentaBright } from 'colorette';
|
||||
|
||||
export function help() {
|
||||
return `
|
||||
export const help = `
|
||||
___ ___ _ __ _ __
|
||||
/ __|/ _ \\ '__| '_ \\
|
||||
\\__ \\ __/ | | | | |
|
||||
@@ -15,4 +14,3 @@ export function help() {
|
||||
${green(
|
||||
`If you have any ideas, suggestions, bug reports, kindly join our support server: https://sern.dev/discord`
|
||||
)}`;
|
||||
}
|
||||
|
||||
@@ -18,14 +18,14 @@ function dispatchInstall() {
|
||||
}
|
||||
|
||||
export async function plugins(options: PluginOptions) {
|
||||
console.log(options)
|
||||
if(options.save) {
|
||||
dispatchSave()
|
||||
}
|
||||
//Download instead based on names given. Must be a full filename ie: (publish.ts)
|
||||
//Download instead based on names given. Must be a full filename ie: (publish)
|
||||
if(options.name) {
|
||||
|
||||
|
||||
|
||||
const pluginSource = await downloa();
|
||||
|
||||
}
|
||||
const e: string[] = (await prompt([await pluginsQ()])).list;
|
||||
if (!e) process.exit(1);
|
||||
@@ -41,16 +41,13 @@ export async function plugins(options: PluginOptions) {
|
||||
);
|
||||
}
|
||||
|
||||
async function downloa(url: string, path: string) {
|
||||
const format = (res: Response) => res.text()
|
||||
const data = await fetch(url, { method: 'GET' })
|
||||
.then(format)
|
||||
async function downloa(url: string | URL) {
|
||||
const formatText = (res: Response) => res.text()
|
||||
return fetch(url, { method: 'GET' })
|
||||
.then(formatText)
|
||||
.catch(() => {
|
||||
throw Error('Download failed! Kindly contact developers')
|
||||
})
|
||||
|
||||
const fullPath = fromCwd(path)
|
||||
|
||||
}
|
||||
|
||||
async function download(url: string) {
|
||||
@@ -60,7 +57,7 @@ async function download(url: string) {
|
||||
|
||||
if (!data) throw new Error('Download failed! Kindly contact developers');
|
||||
|
||||
const dir = `${fromCwd('/src/plugins')}`;
|
||||
const dir = fromCwd('/src/plugins');
|
||||
const filedir = `${process.cwd()}/src/plugins/${url.split('/').pop()}`;
|
||||
|
||||
if (!fs.existsSync(dir)) {
|
||||
|
||||
@@ -12,7 +12,7 @@ const version: string = '[VI]{{inject}}[/VI]';
|
||||
|
||||
program
|
||||
.name('sern')
|
||||
.description(help())
|
||||
.description(help)
|
||||
.version(`sern CLI v${version}`)
|
||||
.exitOverride(() => process.exit(0));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user