Skip to content

How to avoid ambigous values on the command line

Lloyd Brookes edited this page May 4, 2021 · 1 revision

macOS and Linux users: use single instead of double quotes.

Imagine you want to add the text -old to the end of a filename.

$ renamer --find "/$/" --replace "-old" --path-element name --dry-run index.mjs
ERROR: Singular option already set [dry-run=true]

You get a confusing error message about setting --dry-run twice! This is because the command-line parsed the text -old as a cluster of options (-o, -l and -d).

To avoid this, use --option=value notation.

$ renamer --find "/$/" --replace="-old" --path-element name --dry-run index.mjs

Dry run

✔︎ index.mjs → index-old.mjs

Rename complete: 1 of 1 files renamed.