Use the same command options of using --body flag. Make the check of tty in beginning. If it's true, set like user pass the command with this flag. It is the same behavior.
It's also important does not ignore another flags like --header. So, this verification should be the last priority possible in all validation.
When user execute TReq in a not TTY enviroment. Redirecting or piping output, like this...
The TReq should check this and make the output the basic request output.
This check can be made by this function in Crossterm: https://docs.rs/crossterm/latest/crossterm/tty/trait.IsTty.html
Additional Considerations:
Use the same command options of using
--body
flag. Make the check of tty in beginning. If it's true, set like user pass the command with this flag. It is the same behavior.It's also important does not ignore another flags like
--header
. So, this verification should be the last priority possible in all validation.