/make-CLI-File-Name

With one function, convert file name to CLI friendly file name and add additional string t beginning or end.

Primary LanguageHTML

String To CLI-Friendly File Name Converter

Browser Console Application

Note: The makeFileName() function may not be sufficient for all desired file name outputs.
In the file name output, sections of white-space are replaced with a single dash and symbols are removed.
It works for string inputs as shown in the following examples.

makeFileName('How To Tie A Shoelace The 2023 Way');
/* returns 'how-to-tie-a-shoelace-the-2023-way' */

makeFileName('usbcush 67 xhgx% ()#');
/* returns 'usbcush-67-xhgx' */

Instructions

  1. Open the index.html file of this make-cli-file-name directory in a web browser.
  2. Call the makeFileName function with your non-CLI-friendly file name string passed as its argument in your browser console.
  3. Copy the returned string and paste it as your CLI friendly file name.