-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
70 lines (63 loc) · 1.72 KB
/
cli.js
File metadata and controls
70 lines (63 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env node
'use strict';
const { argv } = require('process');
const glow = require('./index.js');
// CLI parser (simple: termglow <command> [args])
const command = argv[2];
const args = argv.slice(3).join(' ');
switch (command) {
case 'box':
glow.box(args || 'Default box content');
break;
case 'table':
// Example data; in real use, parse JSON input
glow.table([
['Header1', 'Header2'],
['Row1 Col1', 'Row1 Col2'],
[42, 'Answer']
]);
break;
case 'loading':
glow.loading('CLI Loading Demo', ['Fetching', 'Building', 'Deploying'], 5000);
break;
case 'progress':
for (let i = 0; i <= 100; i += 20) {
glow.progress(i, 100, { message: 'CLI Progress', signal: '🔄' });
}
break;
case 'glow':
glow.glowText(args || 'CLI Glow Text', glow.colors.fg.magenta);
break;
case 'theme':
glow.theme(args || 'neon');
console.log('Theme applied: ' + args);
break;
case 'image':
glow.image(args);
break;
case 'stats':
glow.fileStats(args);
break;
case 'help':
case '--help':
default:
console.log(`
Termglow CLI - Glow up your terminal!
Usage: termglow <command> [text/path]
Commands:
box [text] - Draw a styled box
table - Render example table (extend with JSON input)
loading [phases] - Run animated loading
progress - Show progress bar
glow [text] - Glow text animation
theme [name] - Switch theme (default/neon/dark)
image [path] - Preview image procedurally
stats [path] - Show file stats table
help - This help
Examples:
termglow box "Hello World!"
termglow image ./photo.jpg
termglow theme neon
`);
}
process.exit(0);