baronTommy / enchant-script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enchant-script

enchant-script

asciicast

yarn add -D enchant-script
# yarn tsc --init
yarn add -D ts-node typescript
{
  "scripts": {
    "selectScript": "ts-node scripts/selectScript"
  }
}

scripts/selectScript/index.ts

import { selectScript, consoleReport } from 'enchant-script';
import { scripts } from '..';

const main = async () => consoleReport(await selectScript(scripts));
main();

scripts/index.ts

import { EnchantScriptsP, betterOption } from 'enchant-script';

export const scripts = new Set<EnchantScriptsP>();

scripts.add({
  script: ['echo ok'],
  opt: {
    name: 'try echo',
    description: 'echo msg',
  },
  ...betterOption,
});

scripts.add({
  script: ['echo foo'],
  opt: {
    name: 'try echo',
    description: 'echo foo',
  },
  ...betterOption,
});

About


Languages

Language:TypeScript 98.8%Language:JavaScript 1.2%