ptest: Add command line parsing
Add a skeleton of a command line parser to the ptest utility. This will allow
future changes to add additional options, such as listing and filtering the
tests that are used.
This adds a single subcommand `run`, which mimics the previous ptest behavior.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/ptest/src/main.rs b/ptest/src/main.rs
index 053448b..2b79974 100644
--- a/ptest/src/main.rs
+++ b/ptest/src/main.rs
@@ -11,6 +11,7 @@
//! jobs->environment->strategy->matric->features
use chrono::Local;
+use clap::{Parser, Subcommand};
use log::{debug, error, warn};
use std::{
collections::HashSet,
@@ -37,6 +38,12 @@
fn main() -> Result<()> {
env_logger::init();
+ let args = Cli::parse();
+
+ match args.command {
+ Commands::Run => (),
+ }
+
let workflow_text = fs::read_to_string("../.github/workflows/sim.yaml")?;
let workflow = YamlLoader::load_from_str(&workflow_text)?;
@@ -76,6 +83,21 @@
Ok(())
}
+/// The main Cli.
+#[derive(Debug, Parser)]
+#[command(name = "ptest")]
+#[command(about = "Run MCUboot CI tests stand alone")]
+struct Cli {
+ #[command(subcommand)]
+ command: Commands,
+}
+
+#[derive(Debug, Subcommand)]
+enum Commands {
+ /// Runs the tests.
+ Run,
+}
+
/// State, for printing status.
struct State {
running: HashSet<String>,