Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
REVIEW: Use plural for `Vec` naming
Lorenz Leutgeb committed 6 months ago
commit e0f6911c9e68e20ef3dcce4969e9abe50334e03d
parent 5df332a6476c2bb8db2c1d8c3b64c1ef099d4d90
2 files changed +16 -16
modified crates/radicle-cli/src/commands/cob.rs
@@ -29,10 +29,10 @@ fn buf_reader(path: std::path::PathBuf) -> io::Result<io::BufReader<std::fs::Fil
fn embeds(
    repo: &storage::git::Repository,
    files: Vec<String>,
-
    oids: Vec<String>,
+
    hashes: Vec<String>,
) -> anyhow::Result<Vec<cob::Embed<cob::Uri>>> {
    parse_many_embeds::<std::path::PathBuf>(&files)
-
        .chain(parse_many_embeds::<Rev>(&oids))
+
        .chain(parse_many_embeds::<Rev>(&hashes))
        .map(|embed| embed.try_into_bytes(repo))
        .collect::<anyhow::Result<Vec<_>>>()
}
@@ -50,14 +50,14 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
            repo,
            type_name,
            message,
-
            embed_file,
-
            embed_hash,
+
            embed_files,
+
            embed_hashes,
            actions,
        }) => {
            let signer = &profile.signer()?;
            let repo = storage.repository_mut(repo)?;
            let reader = buf_reader(actions)?;
-
            let embeds = embeds(&repo, embed_file, embed_hash)?;
+
            let embeds = embeds(&repo, embed_files, embed_hashes)?;

            let oid = match type_name {
                Patch => {
@@ -174,8 +174,8 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
            type_name,
            object,
            message,
-
            embed_file,
-
            embed_hash,
+
            embed_files,
+
            embed_hashes,
            actions,
            ..
        }) => {
@@ -183,7 +183,7 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
            let repo = storage.repository_mut(repo)?;
            let reader = buf_reader(actions)?;
            let oid = object.resolve::<radicle::git::Oid>(&repo.backend)?.into();
-
            let embeds = embeds(&repo, embed_file, embed_hash)?;
+
            let embeds = embeds(&repo, embed_files, embed_hashes)?;

            let oid = match type_name {
                Patch => {
modified crates/radicle-cli/src/commands/cob/args.rs
@@ -105,12 +105,12 @@ pub(super) struct Create {
    pub(super) message: String,

    /// Supply embed of given name via file at given path
-
    #[arg(long, value_names = ["NAME", "PATH"], num_args = 2)]
-
    pub(super) embed_file: Vec<String>,
+
    #[arg(long = "embed-file", value_names = ["NAME", "PATH"], num_args = 2)]
+
    pub(super) embed_files: Vec<String>,

    /// Supply embed of given name via object ID of blob
-
    #[arg(long, value_names = ["NAME", "OID"], num_args = 2)]
-
    pub(super) embed_hash: Vec<String>,
+
    #[arg(long = "embed-hash", value_names = ["NAME", "OID"], num_args = 2)]
+
    pub(super) embed_hashes: Vec<String>,

    /// A file that contains a sequence of actions for the COB, in JSON Lines
    /// format.
@@ -137,12 +137,12 @@ pub(super) struct Update {
    pub(super) message: String,

    /// Supply embed of given name via file at given path
-
    #[arg(long, value_names = ["NAME", "PATH"], num_args = 2)]
-
    pub(super) embed_file: Vec<String>,
+
    #[arg(long = "embed-file", value_names = ["NAME", "PATH"], num_args = 2)]
+
    pub(super) embed_files: Vec<String>,

    /// Supply embed of given name via object ID of blob
-
    #[arg(long, value_names = ["NAME", "OID"], num_args = 2)]
-
    pub(super) embed_hash: Vec<String>,
+
    #[arg(long = "embed-hash", value_names = ["NAME", "OID"], num_args = 2)]
+
    pub(super) embed_hashes: Vec<String>,

    // TODO(finto): `Format` is unused and is obsolete for this command
    /// Desired output format