Skip to content

Conversation

@ddh0
Copy link
Contributor

@ddh0 ddh0 commented Feb 4, 2026

More pleasant formatting for the output of llama-quantize --help.

Before this PR:

Screenshot 2026-02-03 at 10 34 37 PM

After this PR:

Screenshot 2026-02-03 at 10 50 30 PM (this image was previously wrong, updated it to match the current code)

@ddh0 ddh0 requested a review from ggerganov as a code owner February 4, 2026 04:40
printf(" Advanced option to remove all tensors from the given layers\n");
printf(" --keep-split: will generate quantized model in the same shards as input\n");
printf(" --allow-requantize\n");
printf(" allow requantizing tensors that have already been quantized\n");
Copy link
Collaborator

@compilade compilade Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very minor comment, which can be ignored if you want.

This kind of padding might cause unnecessary additional modifications when either adding a longer option (and args) than what exists currently, or when removing options or rewording args.
It's probably not really a problem, though.

But if we'd like to fix that anyway, how about having a constant for the padding (e.g. HELP_PAD or something), and using

    printf("%-*s%s\n", HELP_PAD, "--some-option and args", "some description");
    printf("%-*s%s\n", HELP_PAD, "", "rest of the description");

which is using the * syntax of fields in printf to get the padding from a variable. (And the - is for right-padding)

And then in the future, when padding is updated, we'll only need to change the value of the padding variable.

There could even be a macro for it (if desired):

#define HELP_PAD 42 // for example
#define PRINT_HELP(option, desc) printf("%-*s%s", HELP_PAD, (option), (desc))

Although if using macros, it's also possible to directly inscribe a compile-time known padding inside the printf call.

#define HELP_PAD "42" // notice it's a string
#define PRINT_HELP(option, desc) printf("%-" HELP_PAD "s%s", (option), (desc))

This uses the concatenation of adjacent literal strings in C, but then HELP_PAD (or equivalent) needs to be a literal string.

Keep in mind this is probably not necessary. Manual padding can work fine too. Like I said, feel absolutely free to ignore this suggestion.

Also note that the advantage of not padding is when using very narrow terminals (e.g. when using llama.cpp in Termux on Android). Padded line-wrapping can look weird (although it's already padded in the other examples which use the common/arg.cpp help printing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants