fixsense-cli
Version:
A powerful CLI assistant to record, save, and reuse command-line fixes and code snippets.
16 lines (15 loc) • 466 B
JavaScript
/**
* Validates that the input is a single, non-empty word (no spaces).
* @param {string} input - The input string to validate.
* @returns {boolean|string} - True if valid, otherwise an error message string.
*/
const isValidCommandName = (input) => {
if (!input) {
return 'Input cannot be empty.';
}
if (/\s/.test(input)) {
return 'Command name cannot contain spaces.';
}
return true;
};
module.exports = { isValidCommandName };