Skip to content

fix a few typos on cli help and error messages #714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 4, 2025

Conversation

wbruna
Copy link
Contributor

@wbruna wbruna commented Jul 1, 2025

Not sure if it'd be better to build a dynamic string for the mode list.

@@ -199,14 +200,15 @@ void print_usage(int argc, const char* argv[]) {
printf("\n");
printf("arguments:\n");
printf(" -h, --help show this help message and exit\n");
printf(" -M, --mode [MODEL] run mode (txt2img or img2img or convert, default: txt2img)\n");
printf(" -M, --mode {%s}\n", SD_ALL_MODES_STR);
Copy link
Contributor

Choose a reason for hiding this comment

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

god yes, this has bothered me at a couple of occasions, but I always forget it again.

@leejet
Copy link
Owner

leejet commented Jul 2, 2025

I think it would be better to keep the description of the --mode arguement.

@wbruna
Copy link
Contributor Author

wbruna commented Jul 2, 2025

I think it would be better to keep the description of the --mode arguement.

You mean on the same line and keeping [MODE], like this?

diff --git a/examples/cli/main.cpp b/examples/cli/main.cpp
index 23166df..18be80b 100644
--- a/examples/cli/main.cpp
+++ b/examples/cli/main.cpp
@@ -200,8 +200,7 @@ void print_usage(int argc, const char* argv[]) {
     printf("\n");
     printf("arguments:\n");
     printf("  -h, --help                         show this help message and exit\n");
-    printf("  -M, --mode {%s}\n", SD_ALL_MODES_STR);
-    printf("                                     run mode (default: txt2img)\n");
+    printf("  -M, --mode [MODE]                  run mode (one of %s; default: txt2img)\n", SD_ALL_MODES_STR);
     printf("  -t, --threads N                    number of threads to use during computation (default: -1)\n");
     printf("                                     If threads <= 0, then threads will be set to the number of CPU physical cores\n");
     printf("  -m, --model [MODEL]                path to full model\n");

I was trying to follow the other multi-choice options pattern, because that line is getting rather long (but no strong feelings about it).

@wbruna
Copy link
Contributor Author

wbruna commented Jul 2, 2025

We could also add full descriptions instead:

diff --git a/examples/cli/main.cpp b/examples/cli/main.cpp
index 23166df..ec8401b 100644
--- a/examples/cli/main.cpp
+++ b/examples/cli/main.cpp
@@ -200,8 +200,12 @@ void print_usage(int argc, const char* argv[]) {
     printf("\n");
     printf("arguments:\n");
     printf("  -h, --help                         show this help message and exit\n");
-    printf("  -M, --mode {%s}\n", SD_ALL_MODES_STR);
-    printf("                                     run mode (default: txt2img)\n");
+    printf("  -M, --mode [MODE]                  run mode, one of:\n");
+    printf("                                     txt2img: generate an image from a text prompt (default)\n");
+    printf("                                     img2img: generate an image from a text prompt and an initial image (--init-img)\n");
+    printf("                                     img2vid: generate a video from a text prompt and an initial image (--init-img)\n");
+    printf("                                     edit:    modify an image (--ref-image) based on text instructions\n");
+    printf("                                     convert: convert a model file to gguf format, optionally with quantization\n");
     printf("  -t, --threads N                    number of threads to use during computation (default: -1)\n");
     printf("                                     If threads <= 0, then threads will be set to the number of CPU physical cores\n");
     printf("  -m, --model [MODEL]                path to full model\n");

(I can update the PR, but feel free to change it directly if you wish)

@leejet
Copy link
Owner

leejet commented Jul 3, 2025

We could also add full descriptions instead:

diff --git a/examples/cli/main.cpp b/examples/cli/main.cpp
index 23166df..ec8401b 100644
--- a/examples/cli/main.cpp
+++ b/examples/cli/main.cpp
@@ -200,8 +200,12 @@ void print_usage(int argc, const char* argv[]) {
     printf("\n");
     printf("arguments:\n");
     printf("  -h, --help                         show this help message and exit\n");
-    printf("  -M, --mode {%s}\n", SD_ALL_MODES_STR);
-    printf("                                     run mode (default: txt2img)\n");
+    printf("  -M, --mode [MODE]                  run mode, one of:\n");
+    printf("                                     txt2img: generate an image from a text prompt (default)\n");
+    printf("                                     img2img: generate an image from a text prompt and an initial image (--init-img)\n");
+    printf("                                     img2vid: generate a video from a text prompt and an initial image (--init-img)\n");
+    printf("                                     edit:    modify an image (--ref-image) based on text instructions\n");
+    printf("                                     convert: convert a model file to gguf format, optionally with quantization\n");
     printf("  -t, --threads N                    number of threads to use during computation (default: -1)\n");
     printf("                                     If threads <= 0, then threads will be set to the number of CPU physical cores\n");
     printf("  -m, --model [MODEL]                path to full model\n");

(I can update the PR, but feel free to change it directly if you wish)

Please update the pr.

@wbruna
Copy link
Contributor Author

wbruna commented Jul 3, 2025

I added the detailed descriptions of the modes to the help text.

BTW, I've also noticed the 'SVD support is broken' message, so I'm not mentioning img2vid on the text.

@leejet leejet merged commit 76c7262 into leejet:master Jul 4, 2025
9 checks passed
@leejet
Copy link
Owner

leejet commented Jul 4, 2025

Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants