Skip to content

0xForerunner/clap-interactive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

clap-interactive

A work in progress interactive parser for clap


Demo


hint_demo.mp4

Usage


    #[derive(Parser, Debug)]
    #[command(author, version, about, long_about = None)]
    struct Git {
        #[command(subcommand)]
        subcommand: SubCommand,
        arg: String
    }

    #[derive(Parser, Debug)]
    #[clap(rename_all = "snake_case", infer_subcommands=true)]
    enum SubCommand {
        Commit {
            message: String
        },
        Clone {
            address: String
        }
    }

    fn main() {
        let git = Git::interactive_parse().unwrap();
        println!("{:?}", git);   
    }

Looking for others to contribute


This is a an extremely basic approach at getting clap enums to parse interactively using inquire. If you make improvements to this please submit a PR, and if you have any issues or bugs please submit an issue. I'm currently actively maintaining this project as a person development tool.


About

A work in progress interactive parser for clap

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages