zerodaycode / Zork

Project manager and builder automation tool for modern C++ projects
MIT License
151 stars 10 forks source link

Parse the kind of template generated with an strong type #97

Closed TheRustifyer closed 7 months ago

TheRustifyer commented 1 year ago

Feature Request

Currently, in this code snippet:

New {
        #[arg(help = "Name of the new project")]
        name: String,
        #[arg(long, help = "Initialize a new local git repo")]
        git: bool,
        #[arg(long, default_value = "clang", help = "Which compiler to use")]
        compiler: CppCompiler,
        #[arg(
            long,
            default_value = "basic",
            help = "What configuration file template to use"
        )]
        template: String,
    },

the template argument is being parsed directly as an String.

We need a better way to do this, because the process will only recognize basic and partitions as strings, and if some other String is present, will always choose basic.

This will be much better handled by introducing an enumerated type, analogous for example, to the CppCompiler type, and aborting the process when an incorrect value for that parameter is passed.