Skip to content

Use the € and § aliases for all parameters #704

Closed

Description

@mathiasrw

This is a breaking change.

Today

€ is an alias for $ and § is an alias for \. They are used for some parameters and not for others:

Parameter Aliases used
Pattern Yes
Replacement (also with --replacement-js) Yes
--exclude-re Yes
File globs No
--exclude-glob No
Piped data No

You must know this list to know what a € or a § does. Each new parameter needs its own rule (see --name-delimiter in #703).

Change

Use the aliases for everything you write on the command line. One rule:

€ is $ and § is \ in all parameters. Use --void-euro or --void-section to stop one of them. Use --no-alias to stop the two of them.

The aliases are never used for piped data or for the content of files. That is data, not something you write on the command line.

New flags

  • --void-alias: Stop applying the aliases. It is the same as --void-euro together with --void-section (short form -§€)
  • --no-alias: The same as --void-alias.

The two flags have no short flags. --void-euro and --void-section stay as they are.

Why

  • It is simple to understand and simple to document.
  • It can be done one time, before the engine gets the parameters. It is a search and replace on the parameters. Today it is done in three places: for the pattern and for the replacement in src/engine.ts, and one more time for the replacement in src/cli.ts (so §n becomes a line break, see § for line breaks #700).
  • A new parameter gets the aliases with no extra code.

What breaks

  • A file glob or an --exclude-glob with € or § in it. Today a file with the name price€.txt is found with no flags (documented in Documentation is wrong about where € and § are used as aliases #699). After the change the glob becomes price$.txt. You must use --void-euro, and then the alias is also off for the pattern and the replacement.
  • A § in a glob becomes \. In a glob that is the escape character.
  • The engine no longer knows about the aliases, if they are handled before it. Code that calls the engine directly with voidEuro or voidSection gets no aliases.

To decide

  • Does the engine keep voidEuro and voidSection, or is this only done by the CLI?
  • Is there a need to stop the aliases for the globs only? It is not possible today to have a literal € in a glob and the alias in the pattern in one command. A glob with ? in place of the € is a way around it.

Good to know

  • The aliases are replaced by replacePlaceholders() in src/engine.ts and in the replacement handling in src/cli.ts.
  • -€ and -§ are the short flags for --void-euro and --void-section. If the aliases are replaced in the raw arguments, these two flags must be read first, or -€ becomes -$.
  • yargs reads --no-alias as the negative of a boolean --alias. An alias option that is on by default gives --no-alias with no extra code.
  • The JS tests in test/js/void-euro.test.js and test/js/void-section.test.js (and the fuzzy tests with the same names) test the aliases in the engine. They must test the new place.
  • The README lists where the aliases are used (from Documentation is wrong about where € and § are used as aliases #699). That text becomes the one rule above.

Activity

  1. mathiasrw commented on Oct 23, 2026

    @mathiasrw
    OwnerAuthor

    Solved with one rule, made clear in the help and README in #739: the € and § aliases are used in everything you write on the command line, except globs, file names and piped data. So a file named price€.txt is still found with no flags, and new parameters like the delimiters get the aliases with no extra code. --no-alias was not needed, as -§€ already does it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions