Crate Clap

    Source: https://docs.rs/clap/latest/clap/

    Setup Steps πŸ”—

    An example of project where this was used is zola_chrono but I want to stop including the logging level as part of it and defer to using environment variables as already supported by env_logger.

    • Add dependency
      cargo add clap -F derive,cargo,wrap_help
      
    • Copy cli.rs and add and remove as needed
    • Copy from main.rs as needed
    • Testing
      #[cfg(test)]
      mod tests {
      
          #[test]
          fn verify_cli() {
              // Source: https://docs.rs/clap/latest/clap/_derive/_tutorial/index.html#testing
              // My understanding it reports most development errors without additional effort
              use clap::CommandFactory;
              super::Cli::command().debug_assert()
          }
      }
      

    Example of cargo subcommand πŸ”—

    https://github.com/rust-practice/cargo-leet/