export const grabOption = (needle: string) => { const index = foundAtIndex(needle); return (wasFound(index)) ? undefined : process.argv[index + 1]; }; export const wasFound = (index: number): boolean => index !== -1; export const foundAtIndex = (needle: string): number => process.argv.indexOf(needle); export const wasCommandFound = (needle: string): boolean => (found(needle)); export const wasOptionFound = (needle: string): boolean => (found(`--${needle}`)); export const found = (needle: string): boolean => wasFound(foundAtIndex(needle)); export const getCommandOption = (needle: string) => process.argv[foundAtIndex(needle) + 1];