You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
511 B

/** @module arguments */
/// <reference path="result.js" />
import { ERROR, OK } from "./result.js";
const NO_INPUT_ERROR_MESSAGE = "No file to process. Enter path to file";
/**
* Read argument from nodejs process
* @returns {Result<String>} result of reading argument
*/
function readCliArgument() {
const maybeArgument = process.argv[2];
if (!maybeArgument || maybeArgument.length === 0) {
return [ERROR, NO_INPUT_ERROR_MESSAGE];
}
return [OK, maybeArgument];
}
export { readCliArgument };