-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
executable file
·28 lines (25 loc) · 998 Bytes
/
cli.js
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
#!/usr/bin/env node
import {program} from 'commander';
import {downloadIcon} from './index.js';
program
.name('iconify-svelte')
.description('Download Iconify icons as Svelte components')
.argument('<collection>', 'icon collection (e.g., mdi)')
.argument('<icon>', 'icon name (e.g., account)')
.option('-o, --output <dir>', 'output directory', 'src/icons')
.option('--withts', 'generate TypeScript version', false)
.option('--withjs', 'generate JavaScript version', true)
.action(async (collection, icon, options) => {
try {
const results = await downloadIcon(collection, icon, {
outputDir: options.output, withTs: options.withts, withJs: options.withjs
});
results.forEach(file => {
console.log(`Successfully created: ${file}`);
});
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}
});
program.parse();