1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-11-26 01:00:27 +02:00
simple-icons/scripts/get-filename.js
Eric Cornelissen 7ebf7f71fa
Add documentation and tooling for SVG filenames (#2601)
* Create simple CLI tool to get the filename from a brandname

https://github.com/simple-icons/simple-icons/pull/2589#issuecomment-585902427

* Update contributing guidelines on new SVGs' filenames

* Fix incorrect filename in package.json script

* Add file header to get-filename script

* Update contributing guidelines' section on SVG filenames

Co-Authored-By: YoussefRaafatNasry <youssefraafatnasry@gmail.com>
2020-02-26 17:54:54 +01:00

23 lines
554 B
JavaScript

#!/usr/bin/env node
/**
* @fileoverview
* Takes a brand name as argument and outputs the corresonding filename to
* standard output.
*/
const utils = require('./utils.js');
if (process.argv.length < 3) {
console.error("Provide a brand name as argument")
} else {
let brandName = "";
for (let i = 2; i < process.argv.length; i++) {
brandName += ` ${process.argv[i]}`;
}
brandName = brandName.substring(1);
const filename = utils.titleToFilename(brandName);
console.log(`For '${brandName}' use the filename '${filename}.svg'`);
}