Skip to content

Commit

Permalink
quark: Implement build subcommand
Browse files Browse the repository at this point in the history
Signed-off-by: Julian Labatut <[email protected]>
  • Loading branch information
jlabatut committed Apr 7, 2022
1 parent 814d42e commit d1d29ae
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# Lumper
# Quark

<img src="https://img.shields.io/github/workflow/status/virt-do/quark/quark%20build%20and%20unit%20tests?style=for-the-badge" />

## Build a quardle

Building a `quardle` with the container image bundled into the initramfs image :

```bash
quark build --image <container_image_url> --offline --quardle <quardle_name>
```

Building a `quardle` with the container image to be pulled from within the guest:

```bash
quark build --image <container_image_url> --quardle <quardle_name>
```

## Run a quardle

```bash
quark run --quardle <quardle> --output <output_file>
```
30 changes: 30 additions & 0 deletions src/cli/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use clap::Args;

use super::{Handler, Result};

/// Arguments for `BuildCommand`
///
/// Usage :
/// `quark build --image <container_image_url> [--offline] --quardle <quardle_name>`
#[derive(Debug, Args)]
pub struct BuildCommand {
/// The name of the generated quardle, with the suffix `.qrk`
#[clap(short, long)]
quardle: String,

/// The container image url to use
#[clap(short, long)]
image: String,

/// Indicates wether or not the container image is bundled into the initramfs image
#[clap(short, long)]
offline: bool
}

/// Method that will be called when the command is executed.
impl Handler for BuildCommand {
fn handler(&self) -> Result<()> {
// TODO
Ok(())
}
}
5 changes: 5 additions & 0 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
mod run;
mod build;

use crate::cli::run::RunCommand;
use crate::cli::build::BuildCommand;
use clap::{Parser, Subcommand};

#[derive(Debug)]
Expand All @@ -24,6 +26,7 @@ impl Cli {
/// Return the command used in the cli.
pub fn command(self) -> Box<dyn Handler> {
match self.command {
Command::Build(cmd) => Box::new(cmd),
Command::Run(cmd) => Box::new(cmd),
}
}
Expand All @@ -41,6 +44,8 @@ impl Cli {
/// List(ListCommand)
#[derive(Subcommand, Debug)]
pub enum Command {
/// Build a quardle
Build(BuildCommand),
/// Run a quardle
Run(RunCommand),
}

0 comments on commit d1d29ae

Please sign in to comment.