Skip to content

Make odin help more precise #5181

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 5 commits into from
May 19, 2025
Merged

Make odin help more precise #5181

merged 5 commits into from
May 19, 2025

Conversation

Feoramund
Copy link
Contributor

Fixes #5167

@Kelimion
Copy link
Member

Kelimion commented May 19, 2025

Nice! Still found some differences between odin verb --help and odin help verb:

W:\Odin>odin root --help
W:\Odin\

W:\Odin>odin bundle --help
odin is a tool for managing Odin source code.
Usage:
        odin command [arguments]
Commands:
        build             Compiles directory of .odin files, as an executable.
                          One must contain the program's entry point, all must be in the same package.
        run               Same as 'build', but also then runs the newly compiled executable.
        bundle            Bundles a directory in a specific layout for that platform.
        check             Parses and type checks a directory of .odin files.
        strip-semicolon   Parses, type checks, and removes unneeded semicolons from the entire program.
        test              Builds and runs procedures with the attribute @(test) in the initial package.
        doc               Generates documentation from a directory of .odin files.
        version           Prints version.
        report            Prints information useful to reporting a bug.
        root              Prints the root path where Odin looks for the builtin collections.

For further details on a command, invoke command help:
        e.g. `odin build -help` or `odin help build`

W:\Odin>odin report --help
Where to find more information and get into contact when you encounter a bug:

        Website: https://odin-lang.org
        GitHub:  https://github.com/odin-lang/Odin/issues


Useful information to add to a bug report:

        Odin:    dev-2025-05:b3005dd26
        OS:      Windows 10 Professional (version: 22H2), build 19045.5247
        CPU:     AMD Ryzen 9 5950X 16-Core Processor
        RAM:     65444 MiB
        Backend: LLVM 20.1.0

W:\Odin>odin version --help
odin version dev-2025-05:b3005dd26

I think odin root, odin version, odin report should also act like odin help verb if given --help. At the moment they ignore it and just execute the command.

@Kelimion
Copy link
Member

And a bug. You may have forgotten LIT

W:\Odin>odin help blargle
odin is a tool for managing Odin source code.
Usage:
        odin command [arguments]
Commands:
        build             Compiles directory of .odin files, as an executable.
                          One must contain the program's entry point, all must be in the same package.
        run               Same as 'build', but also then runs the newly compiled executable.
        bundle            Bundles a directory in a specific layout for that platform.
        check             Parses and type checks a directory of .odin files.
        strip-semicolon   Parses, type checks, and removes unneeded semicolons from the entire program.
        test              Builds and runs procedures with the attribute @(test) in the initial package.
        doc               Generates documentation from a directory of .odin files.
        version           Prints version.
        report            Prints information useful to reporting a bug.
        root              Prints the root path where Odin looks for the builtin collections.

For further details on a command, invoke command help:
        e.g. `odin build -help` or `odin help build`

'�-��' is not a recognized command.

This fixes it. If it's a gb.h String, it needs %.*s and LIT.

	if (!help_resolved) {
		usage(arg0);
		print_usage_line(0, "");
		if (command == "help") {
			print_usage_line(0, "'%.*s' is not a recognized flag.", LIT(optional_flag));
		} else {
			print_usage_line(0, "'%.*s' is not a recognized command.", LIT(command));
		}
		return 1;
	}

@Kelimion
Copy link
Member

The timing on that. I'd just closed the tab and in pops an email telling me you pushed further changes. 😁

@Feoramund
Copy link
Contributor Author

I uprooted the check for -help all the way to before command processing, keeping in mind the potential for --. I think this might be simpler than how we're doing it.

@Kelimion Kelimion merged commit b7783ca into odin-lang:master May 19, 2025
7 checks passed
@Kelimion
Copy link
Member

Kelimion commented May 19, 2025

Merged. Alas, we'll have to say goodbye to the easter egg that was odin help blorpus.

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

Successfully merging this pull request may close these issues.

odin help command outputs nonsense
2 participants