CLI tool that will encode and decode a text by Caesar cipher.
CLI tool (test1/index.js) can accept 4 options (short alias and full name):
- -s, --shift: a shift
- -i, --input: an input file
- -o, --output: an output file
- -a, --action: an action encode/decode
Details:
- Action (encode/decode) and the shift are required, if one of them missed - an error will be shown, the process should exit with non-zero status code.
- If the input file is missed - will be used stdin as an input source.
- If the output file is missed - will be used stdout as an output destination.
- If the input and/or output file is given but doesn't exist or you can't read it (e.g. because of permissions or it is a directory) - human-friendly error will be printed in stderr.
- For encoding/decoding will be used only the English alphabet, all other characters will be kept untouched.
Usage example:
$ cd test1
$ node index.js -a encode -s 7 -i "./input.txt" -o "./output.txt"$ cd test1
$ node index.js --action encode --shift 7 --input plain.txt --output encoded.txt$ cd test1
$ node index.js --action decode --shift 7 --input decoded.txt --output plain.txtinput.txt
This is secret. Message about "_" symbol!
output.txt
Aopz pz zljyla. Tlzzhnl hivba "_" zftivs!