My implementaion of the task.
To run the code open any command line and run one of the examples below.
-a
or--action
should be equal toencode
ordecode
, it is a required option;-s
or--shift
should be a not negative integer, it is a required option;-i
or--input
should be a string, it is a relative or an absolete path to the input file. If the file is not found, the message will be shown. If the option will not be provided, you will be offered to enter some text in a command line.-o
or--output
should be a string, it is a relative or an absolete path to the output file. If the file is not found, the message will be shown. If the option will not be provided, the output will be performed to the command line.
node cli.js -s 7 -o output.txt --action encode -i input.txt
or
node cli.js --shift 7 --output "./output.txt" --action encode --input "./input.txt"