···11+[package]
22+name = "gh-grader-preview"
33+version = "0.1.0"
44+edition = "2021"
55+66+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77+88+[dependencies]
99+anyhow = "1.0.79"
1010+clap = { version = "4.4.18", features = ["derive"] }
1111+clap_derive = "4.4.7"
1212+indicatif = "0.17.7"
1313+regex = "1.10.3"
1414+serde = { version = "1.0.196", features = ["derive"] }
1515+serde_json = "1.0.113"
1616+wait-timeout = "0.2.0"
+25
README.md
···11+# GitHub Grader Preview
22+33+Simple program that runs test cases specified in an autograding.json file and reports results. Useful for previewing how GitHub will run your autograder and project.
44+55+Currently this relies on you setting `SHELL` in your environment meaning Windows won't work.
66+77+## Usage
88+99+```sh
1010+gh-grader-preview
1111+```
1212+1313+Will auto-find the `autograding.json` file located in `.github/classroom` relative to the current dir.
1414+1515+You can specify `-f` to choose a different file.
1616+1717+```sh
1818+gh-grader-preview -f some/other/dir/autograding.json
1919+```
2020+2121+For more information, run `gh-grader-preview -h`.
2222+2323+## Building
2424+2525+`cargo build --release`
+30
src/cli.rs
···11+use clap::{command, Parser};
22+33+#[derive(Parser)]
44+#[command(name="gh-grader-preview", author, version, about, long_about = None)]
55+pub struct Cli {
66+ #[arg(
77+ short = 'f',
88+ long = "file",
99+ help = "Override the autograder.json file to use, by default we look in `.github/classroom/autograder.json`"
1010+ )]
1111+ pub file: Option<String>,
1212+ #[arg(
1313+ short = 'v',
1414+ long = "verbose",
1515+ help = "Show stdout and stderr of tests"
1616+ )]
1717+ pub verbose: bool,
1818+ #[arg(
1919+ short = 't',
2020+ long = "test",
2121+ help = "Run only the test specified (must match `name` case-insensitively)"
2222+ )]
2323+ pub test: Option<String>,
2424+ #[arg(
2525+ short = 'x',
2626+ long = "skip",
2727+ help = "Skip the first X tests, useful if you have tests that are purely informational"
2828+ )]
2929+ pub skip: Option<usize>,
3030+}