diff options
-rw-r--r-- | src/cli.rs | 8 | ||||
-rw-r--r-- | src/commands/db.rs | 7 |
2 files changed, 15 insertions, 0 deletions
@@ -255,6 +255,14 @@ pub fn cli<'a>() -> App<'a> { .value_name("HASH") .about("Limit listed submits to one commit hash") ) + .arg(Arg::new("image") + .required(false) + .multiple(false) + .long("image") + .takes_value(true) + .value_name("IMAGE") + .about("Limit listed submits to submits on IMAGE") + ) ) .subcommand(App::new("jobs") diff --git a/src/commands/db.rs b/src/commands/db.rs index f3a6721..38f4beb 100644 --- a/src/commands/db.rs +++ b/src/commands/db.rs @@ -341,6 +341,7 @@ fn submits(conn_cfg: DbConnectionConfig<'_>, matches: &ArgMatches) -> Result<()> let query = schema::submits::table .order_by(schema::submits::id.desc()) // required for the --limit implementation .inner_join(schema::githashes::table.on(schema::submits::repo_hash_id.eq(schema::githashes::id))) + .inner_join(schema::images::table) .into_boxed(); let query = if let Some(commithash) = commit.as_ref() { @@ -349,6 +350,12 @@ fn submits(conn_cfg: DbConnectionConfig<'_>, matches: &ArgMatches) -> Result<()> query }; + let query = if let Some(image) = matches.value_of("image") { + query.filter(schema::images::name.eq(image)) + } else { + query + }; + let submits = if let Some(pkgname) = matches.value_of("with_pkg").map(String::from) { // Get all submits which included the package, but were not necessarily made _for_ the package let query = query |