1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-12-26 01:13:41 +02:00
simple-icons/scripts/get-filename.js

21 lines
562 B
JavaScript
Raw Normal View History

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