-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98dcd68
commit ab8c8f0
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use std::{env, path::PathBuf}; | ||
|
||
use clap::{command, Parser}; | ||
/// Convert an OCI image into a CPIO file | ||
#[derive(Parser, Debug)] | ||
#[command(version, about, long_about = None)] | ||
pub struct CliArgs { | ||
/// The name of the image to download | ||
#[arg(short, long)] | ||
pub image_name: String, | ||
|
||
/// The path to the output file | ||
#[arg(short, long, default_value=get_default_log_path().into_os_string())] | ||
pub ouput_file: PathBuf, | ||
} | ||
|
||
/// Get the default output path for the cpio file. | ||
fn get_default_log_path() -> PathBuf { | ||
let mut path = env::current_exe().unwrap(); | ||
path.pop(); | ||
path.push("output.cpio"); | ||
path | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
use clap::Parser; | ||
|
||
use crate::cli_args::CliArgs; | ||
|
||
mod cli_args; | ||
|
||
fn main() { | ||
println!("Hello, world!"); | ||
let args = CliArgs::parse(); | ||
println!("Hello, world!, {:?}", args); | ||
} |