Skip to content
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

Code crashes without any concrete error and no help documents #928

Open
HackPoint opened this issue Apr 25, 2024 · 1 comment
Open

Code crashes without any concrete error and no help documents #928

HackPoint opened this issue Apr 25, 2024 · 1 comment

Comments

@HackPoint
Copy link

HackPoint commented Apr 25, 2024

Basic example crashes with this error on start:

ERROR(S):
No verb selected.
add Add file contents to the index.
commit Record changes to the repository.
clone Clone a repository into a new directory.
help Display more information on a specific command.
version Display version information.

Process finished with exit code 1.

  • If I need to debug it, how it's being done?
 [Verb("add", HelpText = "Add file contents to the index.")]
    class AddOptions {
        //normal options here
    }
    [Verb("commit", HelpText = "Record changes to the repository.")]
    class CommitOptions {
        //commit options here
    }
    [Verb("clone", HelpText = "Clone a repository into a new directory.")]
    class CloneOptions {
        //clone options here
    }

    static int Main(string[] args) {
        return CommandLine.Parser.Default.ParseArguments<AddOptions, CommitOptions, CloneOptions>(args)
            .MapResult(
                (AddOptions opts) => RunAddAndReturnExitCode(opts),
                (CommitOptions opts) => RunCommitAndReturnExitCode(opts),
                (CloneOptions opts) => RunCloneAndReturnExitCode(opts),
                errs => 1);
    }

    private static int RunCloneAndReturnExitCode(CloneOptions opts)
    {
        return 1;
    }

    private static int RunCommitAndReturnExitCode(CommitOptions opts)
    {
        return 1;
    }

    private static int RunAddAndReturnExitCode(AddOptions opts)
    {
        return 0;
    }
}
@HackPoint HackPoint reopened this Apr 25, 2024
@dafbyte
Copy link

dafbyte commented Jun 30, 2024

Looks like you are missing the argument in the CLI or IDE.
Did you manage to work it out? @HackPoint

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

No branches or pull requests

2 participants