re-format usage information output, update README accordingly

This commit is contained in:
Armin 2026-07-04 20:55:45 +02:00
commit 545ada8bc3
2 changed files with 146 additions and 42 deletions

24
tcd.c
View file

@ -939,8 +939,7 @@ static void print_help(const char *prog)
{
char buf[256];
snprintf(buf, sizeof(buf), ANSI_BOLD ANSI_CYAN "tcd" ANSI_RESET
" \xe2\x80\x94 Transcode Detector "
"Psychoacoustic audio authenticity analysis");
" (Transcode Detector / Psychoacoustic audio authenticity analysis tool)");
int v = vis_len(buf);
printf(" %s", buf);
int pad = tw - 2 - v;
@ -967,30 +966,29 @@ static void print_help(const char *prog)
printf(" " ANSI_BOLD "Options:" ANSI_RESET);
printf("\n");
#define OPT_COL 28
#define OPT(fmt, desc) do { \
printf(" " ANSI_GREEN fmt ANSI_RESET " %s", desc); \
int flen = vis_len(fmt); \
int pad = OPT_COL - flen; \
if (pad < 1) pad = 1; \
printf(" " ANSI_GREEN "%s" ANSI_RESET "%*s%s", fmt, pad, "", desc); \
printf("\n"); \
} while (0)
{
char buf[80];
snprintf(buf, sizeof(buf), "Detection sensitivity 1-99 [" ANSI_CYAN "%d" ANSI_RESET "]", THRESHOLD_DEFAULT);
snprintf(buf, sizeof(buf), "Detection sensitivity 1-99 [" ANSI_CYAN "%d" ANSI_RESET "]", THRESHOLD_DEFAULT);
OPT("-t, --threshold PCT", buf);
}
{
char buf[80];
snprintf(buf, sizeof(buf), ANSI_DIM " Lower = fewer, higher = more" ANSI_RESET);
printf(" %s", buf);
printf("\n");
snprintf(buf, sizeof(buf), "FFT size, power of 2 [" ANSI_CYAN "%d" ANSI_RESET "]", FFT_SIZE_DEFAULT);
OPT("-f, --fft-size N", buf);
}
{
char buf[80];
snprintf(buf, sizeof(buf), "FFT size, power of 2 [" ANSI_CYAN "%d" ANSI_RESET "]", FFT_SIZE_DEFAULT);
OPT("-f, --fft-size N", buf);
}
{
char buf[80];
snprintf(buf, sizeof(buf), "Seconds to analyze [" ANSI_CYAN "%d" ANSI_RESET "]", MAX_ANALYSIS_SECS);
snprintf(buf, sizeof(buf), "Seconds to analyze [" ANSI_CYAN "%d" ANSI_RESET "]", MAX_ANALYSIS_SECS);
OPT("-d, --duration SEC", buf);
}
OPT("-r, --recursive", "Recurse into subdirectories");