Skip to content

CLI Flag verbose

Manech Dubreil edited this page Oct 21, 2026 · 1 revision

--verbose

Status: ✅ Implemented (#54)

Prints each step of the command on stderr, one line per step, prefixed with [verbose].

Usage

transf-orm --verbose convert schema.prisma
transf-orm convert schema.prisma --verbose     # global flag: also accepted after the command
transf-orm --verbose convert schema.prisma > pivot.json

Behavior

  • Steps go to stderr only: stdout keeps the command's real output (e.g. the JSON pivot), byte-for-byte identical with or without --verbose, so redirecting or piping stdout still produces valid JSON.
  • Without the flag, nothing extra is printed.
  • The text is stable (no timings, no absolute paths — only the path given on the command line) so it can be snapshot-tested.
  • Can be combined with --debug.

convert

$ transf-orm --verbose convert schema.prisma > pivot.json
[verbose] Detecting ORM format for schema.prisma
[verbose] Source ORM: Prisma
[verbose] Reading schema.prisma
[verbose] Importing schema with the Prisma importer
[verbose] Imported 11 tables, 1 views, 3 enums
[verbose] Writing canonical JSON pivot to stdout

With --from, the detection step is replaced by:

[verbose] Using ORM forced by --from: prisma

Server mode

$ transf-orm --serveur --port 8080 --verbose
[verbose] Listening port: 8080
Starting transf-orm server on port 8080

Implementation

  • GlobalConfig::verbose (crates/core/src/config.rs) carries the flag to both modes.
  • crates/cli/src/lib.rs — the step(config, message) helper prints [verbose] <message> with eprintln! when config.verbose is set. run_convert calls it at every step.
  • crates/server/src/lib.rs — prints the listening port.
  • Tests in crates/transf-orm/tests/dispatch.rs, on the fixture tests/fixtures/verbose.prisma:
    • verbose_output_snapshot — exact comparison of the whole stderr output;
    • verbose_with_from_reports_forced_orm;
    • verbose_keeps_stdout_unchanged — stdout is identical with and without the flag;
    • no_flag_prints_nothing_on_stderr.

Adding steps to a new command

Call step(config, ...) for anything the user should follow, and never use println! for progress — stdout is reserved for the command's output. Internal details belong in --debug logs instead. Update the snapshot test when the steps change.


← CLI

Clone this wiki locally