beeline-cli
Version:
A terminal wallet for the Hive blockchain - type, sign, rule the chain
126 lines (122 loc) • 4.98 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const neon_js_1 = require("../utils/neon.js");
class Theme extends core_1.Command {
async run() {
const { args } = await this.parse(Theme);
const { action, theme } = args;
switch (action) {
case 'list':
await this.listThemes();
break;
case 'set':
if (!theme) {
this.error('Theme name is required for set action. Available themes: ' + (0, neon_js_1.listThemes)().join(', '));
}
await this.setTheme(theme);
break;
case 'preview':
if (!theme) {
this.error('Theme name is required for preview action. Available themes: ' + (0, neon_js_1.listThemes)().join(', '));
}
await this.previewTheme(theme);
break;
default:
this.error(`Unknown action: ${action}`);
}
}
async listThemes() {
const currentTheme = await (0, neon_js_1.getCurrentThemeName)();
const availableThemes = (0, neon_js_1.listThemes)();
const theme = await (0, neon_js_1.getTheme)();
console.log(theme.createBox(`Available Styles:
${availableThemes.map(t => {
const displayName = neon_js_1.themes[t].name;
return t === currentTheme
? theme.chalk.success(`▶ ${displayName} (current)`)
: theme.chalk.info(` ${displayName}`);
}).join('\n')}
Use 'theme set <name>' to switch styles
Use 'theme preview <name>' to see a style demo`, 'STYLE MANAGER'));
}
async setTheme(themeName) {
if (!(0, neon_js_1.listThemes)().includes(themeName)) {
this.error(`Invalid theme: ${themeName}. Available themes: ${(0, neon_js_1.listThemes)().join(', ')}`);
}
await (0, neon_js_1.setTheme)(themeName);
const theme = await (0, neon_js_1.getTheme)();
// Show theme preview after switching
console.log(theme.chalk.success(`✓ Theme switched to: ${theme.name}`));
console.log('');
// Show a preview of the new theme
await this.previewTheme(themeName);
}
async previewTheme(themeName) {
if (!(0, neon_js_1.listThemes)().includes(themeName)) {
this.error(`Invalid theme: ${themeName}. Available themes: ${(0, neon_js_1.listThemes)().join(', ')}`);
}
await (0, neon_js_1.setTheme)(themeName);
const theme = await (0, neon_js_1.getTheme)();
console.log('');
console.log(theme.chalk.accent('═'.repeat(60)));
console.log(theme.chalk.highlight(` ${theme.name.toUpperCase()} STYLE PREVIEW`));
console.log(theme.chalk.accent('═'.repeat(60)));
console.log('');
// Show banner
try {
const banner = await theme.createBanner('BEELINE');
console.log(banner);
}
catch (error) {
// Fallback if figlet fails
console.log(theme.chalk.glow('BEELINE WALLET'));
}
console.log('');
// Show styled elements
console.log(theme.createBox(`Colors and Effects:
${theme.chalk.success('✓ Success messages')}
${theme.chalk.error('✗ Error messages')}
${theme.chalk.warning('⚠ Warning messages')}
${theme.chalk.info('ℹ Info messages')}
${theme.chalk.glow('★ Glow effects')}
${theme.chalk.pulse('◆ Pulse effects')}
${theme.chalk.highlight('▶ Highlights')}
Balance: ${theme.chalk.success('1,337.42 HIVE')}
Address: ${theme.chalk.accent('@alice')}
Status: ${theme.chalk.glow('CONNECTED')}`, `${theme.name} Preview`));
console.log('');
console.log(theme.chalk.accent('═'.repeat(60)));
// Show rain effect for terminal theme
if (themeName === 'matrix') {
console.log(theme.chalk.info('Activating terminal mode...'));
console.log('');
await (0, neon_js_1.playMatrixRain)(2000);
console.log(theme.chalk.success('🔋 Terminal theme activated!'));
}
else {
console.log(theme.chalk.success(`🎨 ${theme.name} theme activated!`));
}
}
}
Theme.description = 'Manage terminal styling and visual effects';
Theme.examples = [
'<%= config.bin %> <%= command.id %> list',
'<%= config.bin %> <%= command.id %> set cyberpunk',
'<%= config.bin %> <%= command.id %> set matrix',
'<%= config.bin %> <%= command.id %> preview matrix'
];
Theme.flags = {};
Theme.args = {
action: core_1.Args.string({
description: 'Action to perform: list, set, preview',
required: true,
options: ['list', 'set', 'preview']
}),
theme: core_1.Args.string({
description: 'Theme name when using set or preview',
required: false
})
};
exports.default = Theme;
//# sourceMappingURL=theme.js.map