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