Skip to content

Warn when piped data is not used #719

Closed

Description

@mathiasrw

Today

There are two kinds of messages: info and errors.

When data is piped in and files are also given, the piped data is not used (unless a flag like --replacement-pipe says what it is for). Nothing tells about this. Only with --verbose there is a line: Piped data never used.

> cat notes.txt | rexreplace foo bar my.file
my.file

Change

Add warnings as a third kind of message, and use it for this case.

  • A warning starts with 🟡 and goes to stderr.
  • --quiet and --quiet-total hide it.
  • It never stops the run, also not with --halt.
  • --void-pipe means the piped data is not wanted, so there is no warning then.
> cat notes.txt | rexreplace foo bar my.file
 🟡 Data is piped in, but no flag tells what to do with it. It is not used.
my.file

To decide

  • Empty piped data, or only a line break: is that also a warning? On the v8.0 branch it was not.

Good to know

  • This was made on the v8.0 branch, which is not merged, as warn() in src/output.ts. On that branch the run stopped after the warning, which looks like a mistake.
  • With --replacement-js the piped data can be used from the code as pipe, so there is no warning then.
  • "Error != warning" is on the list of future ideas in the README.

Reference

This was made before, on a branch that is not merged. Look at it to see how it was done. It can not be copied as it is, as it is written for older code.

Activity

  1. linked a pull request that will close this issueWarn when piped data is not used #727on Oct 12, 2026
  2. added a commit that references this issue on Oct 12, 2026
  3. mathiasrw commented on Oct 13, 2026

    @mathiasrw
    OwnerAuthor

    Implemented: warn() in src/output.ts, used for piped data that is not used. Empty piped data, or only a line break, gives no warning (as on v8.0).

  4. added a commit that references this issue on Oct 13, 2026
    29b8088
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions