jlevy / jlevy/flowmark-rs

Silently accepts contradictory flag combinations (--auto + -o/--output, --auto + --check)

Open
#76 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
17
Forks
2
Avg merge
5h 10m
Merged PRs (30d)
7

Description

## Summary

`--auto` is a preset that implies `--inplace` (which, per `--help`, "ignores --output"). Combining `--auto` with `--output`/`-o`, or with `--check`, is contradictory — but flowmark accepts the combination silently instead of erroring, which produces confusing no-ops.

### `--auto` + `-o -` / `--output`

```
$ flowmark --auto -o - FILE
# exit 0, nothing on stdout, FILE unchanged, no error/warning
```

Because `--auto` ⇒ `--inplace` and `--inplace` ignores `--output`, this writes nothing to stdout. It is easy to mistake the empty stdout for "flowmark produced an empty document" when piping into another tool or a diff — it sent me down a long, wrong debugging path before I realized `-o` was being silently dropped.

### `--auto` + `--check`

```
$ flowmark --auto --check FILE
```

`--auto` means "format in place"; `--check` means "don't write anything." The combination is contradictory, but it runs silently as a check (the in-place intent is dropped). It is also what a Makefile/CI naturally ends up writing (`flowmark --auto --check .`) when mirroring `flowmark --auto .`, which hides the contradiction.

## Request

Emit a clear, consistent error (or at least a warning) for incompatible flag combinations — `--auto` together with `--output`/`-o`, and `--auto` together with `--check` — instead of silently ignoring one side. Predictable errors on contradictory flags would prevent the silent no-ops above.

## Note

The same flag handling is present in flowmark-py 0.7.2 (filed separately; link to follow), so this likely belongs in the shared CLI design.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.