bepaald / signalbackup-tools

Tool to work with Signal Backup files.
GNU General Public License v3.0
755 stars 36 forks source link

Ability to override/inhibit column's width/truncation #219

Closed drzraf closed 2 months ago

drzraf commented 2 months ago

Current code for prettyPrint handles table-output (and fields truncation). For this an availableWidth function does the following ioctl(STDOUT_FILENO, TIOCGWINSZ, &ts)

what doesn't work in the case of output redirection. As a consequence, width is restricted what triggers truncation mechanisms thus generating an unusable file (what is bad if it goes unnoticed by the user)

Either output should work as intended (and bypass the truncation mechanism) (see #218), either the user must be able to opt-out truncation. Could be looking for COLUMNS environment variable or MySQL-like --raw flag, ...

BTW I failed to find a way to workaround this (other than copy/pasting the output). No bash-fd-redirection-tweak-syntax-foo would help me duplicating stdout without TIOCGWINSZ being triggered.

bepaald commented 2 months ago

I will see what I can do to bypass truncation when using --logfile to write output to file.

bepaald commented 2 months ago

I have added a --no-truncate option that bypasses availableWidth(). You should be able to make use of it in conjunction with redirection or the --logfile option. Let me know if it works for you.

Thanks!

drzraf commented 2 months ago
  1. I'm sorry to have missed the --logfile option. I didn't tested it since I stayed concentrated on --ouput.
  2. I confirm this --no-truncate works perfectly.

Thank you!

bepaald commented 2 months ago

Great! Glad to hear it. Thanks for the feedback!