UNPKG

campus-tex-cli

Version:

A CLI to quickly generate latex files for presentations or task assignments, using the unofficial template by the University of Stuttgart.

27 lines (26 loc) 886 B
import figlet from "figlet"; import { cristal } from "gradient-string"; import { sleep } from "./util/sleep.js"; import { getUserInput } from "./lib/getUserInput.js"; import { injectDataIntoLatex } from "./lib/injectDataIntoLatex.js"; import { handleCustomTemplate } from "./lib/handleCustomTemplate.js"; export const handleProgram = async (command) => { //Welcome user console.clear(); const msg = "CampusTex"; figlet(msg, (err, data) => { console.log(cristal.multiline(data)); }); await sleep(100); const options = command.opts(); if (options.template) { return handleCustomTemplate(options.template); } //Get user inputs const userInputs = await getUserInput(); if (options.output) { userInputs.outputDirectory = options.output; } //Inject user inputs into latex injectDataIntoLatex(userInputs); };