UNPKG

@harryisfish/gitt

Version:

这是一个命令行工具,用于帮助你管理 Git 仓库与远端仓库,如保持同步、推送、拉取等。

60 lines (59 loc) 1.65 kB
import chalk from 'chalk'; // 自定义颜色 const colors = { primary: chalk.cyan, success: chalk.green, warning: chalk.yellow, error: chalk.red, muted: chalk.gray, highlight: chalk.blue, info: chalk.white, }; // 自定义图标 const icons = { pointer: '❯', done: '✔', error: '✖', waiting: '○', }; // 定义主题 export const theme = { prefix: { idle: colors.primary('?'), done: colors.success(icons.done), }, spinner: { interval: 100, frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'], }, icon: { cursor: colors.primary(icons.pointer), }, style: { // 答案样式 answer: (text) => colors.success(text), // 问题样式 message: (text, status) => { switch (status) { case 'loading': return colors.muted(text); case 'done': return colors.success(text); default: return colors.primary(text); } }, // 错误信息样式 error: (text) => colors.error(icons.error + ' ' + text), // 帮助信息样式 help: (text) => colors.muted(text), // 高亮样式 highlight: (text) => colors.highlight(text), // 选项描述样式 description: (text) => colors.muted(`\n ${text}`), // 禁用选项样式 disabled: (text) => colors.muted(`${icons.waiting} ${text}`), }, // 帮助提示显示模式:'always' | 'never' | 'auto' helpMode: 'auto', };