Add support to specify a mapping from the CLI
ericcornelissen opened this issue · 0 comments
ericcornelissen commented
Add support to specify individual mappings from the CLI. This would make the tool useful in other scenarios as well, where e.g. you want to run it quickly to fix a common mistake you just discovered in your text files.
Proposal
This proposal is quite simple: add a new CLI argument that can be used to specify a single mapping. For example (--inline-mapping
is just for illustration, I don't necessary like the name):
$ wordrow input.txt --inline-mapping cat,dog
# If spaces are wanted/needed, quotation marks are required
$ wordrow input.txt --inline-mapping "cat, dog"
$ wordrow input.txt --inline-mapping "hello world, hey planet"
To specify multiple inline mappings, the argument can simply be reused. For example:
$ wordrow input.txt --inline-mapping cat,dog --inline-mapping horse,donkey
Discussion
Alternative implementations
Another option is to take the two arguments following the --inline-mapping
argument as the "from" and "to" value. Personally, I'm not a fan of this, as I think it doesn't read as clearly.
$ wordrow input.txt --inline-mapping cat dog