Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

cli: Expose certificate_directory #180

Merged
merged 3 commits into from
Dec 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use ostree::{gio, glib};
use std::collections::BTreeMap;
use std::convert::TryFrom;
use std::ffi::OsString;
use std::path::PathBuf;
use structopt::StructOpt;

use crate::container as ostree_container;
Expand Down Expand Up @@ -130,7 +131,12 @@ enum ContainerOpts {
struct ContainerProxyOpts {
#[structopt(long)]
/// Path to Docker-formatted authentication file.
authfile: Option<String>,
authfile: Option<PathBuf>,

#[structopt(long)]
/// Directory with certificates (*.crt, *.cert, *.key) used to connect to registry
/// Equivalent to `skopeo --cert-dir`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this too long for the help text?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I just tried this out and it looks like structopt eats newlines, but does do auto-wrapping. I just tried e.g.:

diff --git a/lib/src/cli.rs b/lib/src/cli.rs
index e6cbaee..9726fcb 100644
--- a/lib/src/cli.rs
+++ b/lib/src/cli.rs
@@ -162,6 +162,7 @@ enum ContainerImageOpts {
     },
 
     /// Copy a pulled container image from one repo to another.
+    /// Blah blah.  Lorem ipsum foo bar baz. Lorem ipsum foo bar baz. Lorem ipsum foo bar baz. Lorem ipsum foo bar baz.
     Copy {
         /// Path to the source repository
         #[structopt(long)]

And I get:

walters@toolbox /v/s/w/s/g/o/ostree-rs-ext (main)> cargo b; and ./target/debug/ostree-ext-cli container image --help
   Compiling ostree-ext v0.5.1 (/var/srv/walters/src/github/ostreedev/ostree-rs-ext/lib)
   Compiling ostree-ext-cli v0.1.4 (/var/srv/walters/src/github/ostreedev/ostree-rs-ext/cli)
    Finished dev [optimized + debuginfo] target(s) in 6.94s
ostree-ext-cli-container-image 0.5.1
Commands for working with (possibly layered, non-encapsulated) container images

USAGE:
    ostree-ext-cli container image <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    copy      Copy a pulled container image from one repo to another. Blah blah.  Lorem ipsum foo bar baz. Lorem
              ipsum foo bar baz. Lorem ipsum foo bar baz. Lorem ipsum foo bar baz
    deploy    Perform initial deployment for a container image
    help      Prints this message or the help of the given subcommand(s)
    list      List container images
    pull      Pull (or update) a container image
walters@toolbox /v/s/w/s/g/o/ostree-rs-ext (main)> 

Soo...it should be fine if you just add a period . at the end of sentences. Or it could be:

/// Directory with certificates (*.crt, *.cert, *.key) used to connect to registry; equivalent to `skopeo --cert-dir`.

or so?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never added the period but not sure that's important

cert_dir: Option<PathBuf>,

#[structopt(long)]
/// Skip TLS verification.
Expand Down Expand Up @@ -243,6 +249,7 @@ impl Into<ostree_container::store::ImageProxyConfig> for ContainerProxyOpts {
fn into(self) -> ostree_container::store::ImageProxyConfig {
ostree_container::store::ImageProxyConfig {
authfile: self.authfile,
certificate_directory: self.cert_dir,
insecure_skip_tls_verification: Some(self.insecure_skip_tls_verification),
..Default::default()
}
Expand Down