2020-02-26 18:54:54 +02:00
|
|
|
#!/usr/bin/env node
|
|
|
|
/**
|
|
|
|
* @fileoverview
|
2021-02-08 18:14:31 +02:00
|
|
|
* Script that takes a brand name as argument and outputs the corresponding
|
|
|
|
* icon SVG filename to standard output.
|
2020-02-26 18:54:54 +02:00
|
|
|
*/
|
|
|
|
|
2021-12-25 16:22:56 +02:00
|
|
|
import { titleToSlug } from './utils.js';
|
2020-02-26 18:54:54 +02:00
|
|
|
|
|
|
|
if (process.argv.length < 3) {
|
2021-10-25 21:13:10 +02:00
|
|
|
console.error('Provide a brand name as argument');
|
2021-02-08 18:14:31 +02:00
|
|
|
process.exit(1);
|
2020-02-26 18:54:54 +02:00
|
|
|
} else {
|
2021-10-25 21:13:10 +02:00
|
|
|
const brandName = process.argv
|
|
|
|
.slice(3)
|
2021-02-08 18:14:31 +02:00
|
|
|
.reduce((acc, arg) => `${acc} ${arg}`, process.argv[2]);
|
2020-02-26 18:54:54 +02:00
|
|
|
|
2021-02-22 15:15:37 +02:00
|
|
|
const filename = titleToSlug(brandName);
|
2021-02-08 18:14:31 +02:00
|
|
|
console.log(`For '${brandName}' use the file 'icons/${filename}.svg'`);
|
2020-02-26 18:54:54 +02:00
|
|
|
}
|