Skip to content

Commit

Permalink
Update clap
Browse files Browse the repository at this point in the history
  • Loading branch information
termoshtt committed Apr 6, 2024
1 parent 42cc273 commit 267c23b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ocipkg-cli/src/bin/cargo-ocipkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn main() -> Result<()> {
.parse_default_env()
.init();

match Opt::from_args() {
match Opt::parse() {
Opt::Ocipkg(Ocipkg::Build {
package_name,
release,
Expand Down
21 changes: 7 additions & 14 deletions ocipkg-cli/src/bin/ocipkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,41 @@ use ocipkg::error::*;
use std::{fs, path::*};

#[derive(Debug, Parser)]
#[clap(version)]
#[command(version)]
enum Opt {
/// Pack a directory into an oci-archive tar file
Pack {
/// Path of input directory to be packed
#[clap(parse(from_os_str))]
input_directory: PathBuf,

/// Path of output tar archive in oci-archive format
#[clap(parse(from_os_str))]
output: PathBuf,

/// Name of container, use UUID v4 hyphenated if not set.
#[clap(short = 't', long = "tag")]
#[arg(short = 't', long = "tag")]
tag: Option<String>,

/// Path to annotations file.
#[clap(parse(from_os_str), default_value = "ocipkg.toml")]
#[arg(default_value = "ocipkg.toml")]
annotations: PathBuf,
},

/// Compose files into an oci-archive tar file
Compose {
/// Path of input file to be packed
#[clap(parse(from_os_str))]
inputs: Vec<PathBuf>,

/// Path of output tar archive in oci-archive format
#[clap(short = 'o', long = "output", parse(from_os_str))]
#[arg(short = 'o', long = "output")]
output: PathBuf,

/// Name of container, use UUID v4 hyphenated if not set.
#[clap(short = 't', long = "tag")]
#[arg(short = 't', long = "tag")]
tag: Option<String>,

/// Path to annotations file.
#[clap(
#[arg(
long = "annotations",
parse(from_os_str),
default_value = "ocipkg.toml"
)]
annotations: PathBuf,
Expand All @@ -52,7 +48,6 @@ enum Opt {
/// Load and expand container local cache
Load {
/// Input oci-archive
#[clap(parse(from_os_str))]
input: PathBuf,
},

Expand All @@ -64,7 +59,6 @@ enum Opt {
/// Push oci-archive to registry
Push {
/// Input oci-archive
#[clap(parse(from_os_str))]
input: PathBuf,
},

Expand All @@ -88,7 +82,6 @@ enum Opt {
/// Inspect components in OCI archive
Inspect {
/// Input oci-archive
#[clap(parse(from_os_str))]
input: PathBuf,
},
}
Expand All @@ -99,7 +92,7 @@ fn main() -> Result<()> {
.parse_default_env()
.init();

match Opt::from_args() {
match Opt::parse() {
Opt::Pack {
input_directory,
output,
Expand Down

0 comments on commit 267c23b

Please sign in to comment.