Description
Proposal
Updaptes
- As per Implement new flag for printing the executed commands #1068 (comment),
adding the short flag-P
is no longer required. Only the long flag--print-exec
may be implemented.
Original
This is essentially the same request as #943, which was closed by the original author.
Now that #406 has been implemented, this feature seems feasible again.
I propose to add a new flag -P, --print-exec
, which by default will be disabled.
When enabled, it causes fd to print the full command line just before executing it.
Also, when color output is enabled at the same time, all parts in the command line which originally were placeholders will be highlighted.
This new flag adds a shortcut and formatting as a bonus for the common case of using
--exec
twice to display and execute a command.
A similar convenience flag -l, --list-details
already exists.
This feature request is in contrast to #1037, which proposes for only the filename to be printed.
Examples
Existing default behavior does not change:
$ fd -e rs -x rustfmt
<no output>
With -P
flag enabled:
$ fd -P -e rs -x rustfmt
rustfmt ./src/lib.rs
rustfmt ./src/main.rs
Here, the ./src/###.rs
part would be highlighted.
With -P
flag enabled and multiple placeholders:
$ fd -P -e wav -x flac -o {.}.flac -T "TITLE=Song" {}
flac -o ./song.flac -T "TITLE=Song" ./song.wav
Here, both ./song.flac
and ./song.wav
would be highlighted.