From d32a10b4b932e979d9eb1c4a8d1515ecc9db3c15 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Thu, 30 Nov 2023 17:16:35 +0000 Subject: [PATCH] cli: move rad assign/unassign under rad issue and rad patch It is more natural for the assign and unassign commands to exist as subcommands of the object they are assigning to, i.e. issues and patches. Remove the rad assign and rad unassign commands, moving their functionality to the rad issue and rad patch commands. The rad-issue.md and rad-patch.md tests are modified to include a assign test. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-cli/examples/rad-issue.md | 4 +- radicle-cli/examples/rad-patch.md | 25 +++--- radicle-cli/src/commands.rs | 4 - radicle-cli/src/commands/assign.rs | 95 ----------------------- radicle-cli/src/commands/help.rs | 2 - radicle-cli/src/commands/issue.rs | 70 +++++++++++++++-- radicle-cli/src/commands/patch.rs | 51 +++++++++++- radicle-cli/src/commands/patch/assign.rs | 29 +++++++ radicle-cli/src/commands/unassign.rs | 98 ------------------------ radicle-cli/src/main.rs | 14 ---- 10 files changed, 157 insertions(+), 235 deletions(-) delete mode 100644 radicle-cli/src/commands/assign.rs create mode 100644 radicle-cli/src/commands/patch/assign.rs delete mode 100644 radicle-cli/src/commands/unassign.rs diff --git a/radicle-cli/examples/rad-issue.md b/radicle-cli/examples/rad-issue.md index 34de939d..19cd78d0 100644 --- a/radicle-cli/examples/rad-issue.md +++ b/radicle-cli/examples/rad-issue.md @@ -51,7 +51,7 @@ Let's assign ourselves to this one, this is to ensure work is not duplicated. While we're at it, let's add a label. ``` -$ rad assign d185ee16a00bac874c0bcbc2a8ad80fdce5e1e6 --to did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi +$ rad issue assign d185ee1 --add did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi $ rad issue label d185ee1 -l good-first-issue ``` @@ -69,7 +69,7 @@ $ rad issue list --assigned Note: this can always be undone with the `unassign` subcommand. ``` -$ rad unassign d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 --from did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi +$ rad issue assign d185ee1 --remove did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` Great, now we have communicated to the world about our car's defect. diff --git a/radicle-cli/examples/rad-patch.md b/radicle-cli/examples/rad-patch.md index 1d1223fa..d5d7947d 100644 --- a/radicle-cli/examples/rad-patch.md +++ b/radicle-cli/examples/rad-patch.md @@ -89,10 +89,13 @@ $ git branch -vv master f2de534 [rad/master] Second commit ``` -We also want to label the patch after we've created it: +We can also label patches as well as assign DIDs to the patch to help +organise your workflow: + ``` -$ rad patch label 6ff4f09c1b5a81347981f59b02ef43a31a07cdae -l fun -$ rad patch show 6ff4f09c1b5a81347981f59b02ef43a31a07cdae +$ rad patch label 6ff4f09 -l fun +$ rad patch assign 6ff4f09 --add did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi +$ rad patch show 6ff4f09 ╭────────────────────────────────────────────────────╮ │ Title Define power requirements │ │ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae │ @@ -123,7 +126,7 @@ $ git commit --message "Add README, just for the fun" ``` ``` (stderr) $ git push rad -o patch.message="Add README, just for the fun" -✓ Patch 6ff4f09 updated to 873e637a66be511c45f4ef7b04fddc9def8f072c +✓ Patch 6ff4f09 updated to e0fd9f00b51e10e1ca88868e68e46e859ed371d7 To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 3e674d1..27857ec flux-capacitor-power -> patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae ``` @@ -131,13 +134,13 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE And let's leave a quick comment for our team: ``` -$ rad patch comment 6ff4f09c1b5a81347981f59b02ef43a31a07cdae --message 'I cannot wait to get back to the 90s!' +$ rad patch comment 6ff4f09 --message 'I cannot wait to get back to the 90s!' ╭───────────────────────────────────────╮ -│ z6MknSL…StBU8Vi (you) now efaf6fb │ +│ z6MknSL…StBU8Vi (you) now f5b4613 │ │ I cannot wait to get back to the 90s! │ ╰───────────────────────────────────────╯ -$ rad patch comment 6ff4f09c1b5a81347981f59b02ef43a31a07cdae --message 'My favorite decade!' --reply-to efaf6fb -q -2cb22a1c87af86c25368c7be9fc385720fd6086f +$ rad patch comment 6ff4f09 --message 'My favorite decade!' --reply-to f5b4613 -q +611df66ccb3803b604a59f2efa9a42d72256dd49 ``` Now, let's checkout the patch that we just created: @@ -151,7 +154,7 @@ $ rad patch checkout 6ff4f09 We can also add a review verdict as such: ``` -$ rad review 6ff4f09c1b5a81347981f59b02ef43a31a07cdae --accept --no-message --no-sync +$ rad review 6ff4f09 --accept --no-message --no-sync ✓ Patch 6ff4f09 accepted ``` @@ -175,7 +178,7 @@ $ rad patch show 6ff4f09 │ 3e674d1 Define power requirements │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) now │ -│ ↑ updated to 873e637a66be511c45f4ef7b04fddc9def8f072c (27857ec) now │ +│ ↑ updated to e0fd9f00b51e10e1ca88868e68e46e859ed371d7 (27857ec) now │ │ ✓ accepted by z6MknSL…StBU8Vi (you) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` @@ -201,7 +204,7 @@ $ rad patch show 6ff4f09 │ 3e674d1 Define power requirements │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) now │ -│ ↑ updated to 873e637a66be511c45f4ef7b04fddc9def8f072c (27857ec) now │ +│ ↑ updated to e0fd9f00b51e10e1ca88868e68e46e859ed371d7 (27857ec) now │ │ ✓ accepted by z6MknSL…StBU8Vi (you) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` diff --git a/radicle-cli/src/commands.rs b/radicle-cli/src/commands.rs index 74b88036..c1c74d12 100644 --- a/radicle-cli/src/commands.rs +++ b/radicle-cli/src/commands.rs @@ -1,5 +1,3 @@ -#[path = "commands/assign.rs"] -pub mod rad_assign; #[path = "commands/auth.rs"] pub mod rad_auth; #[path = "commands/checkout.rs"] @@ -46,7 +44,5 @@ pub mod rad_self; pub mod rad_sync; #[path = "commands/track.rs"] pub mod rad_track; -#[path = "commands/unassign.rs"] -pub mod rad_unassign; #[path = "commands/untrack.rs"] pub mod rad_untrack; diff --git a/radicle-cli/src/commands/assign.rs b/radicle-cli/src/commands/assign.rs deleted file mode 100644 index db91da96..00000000 --- a/radicle-cli/src/commands/assign.rs +++ /dev/null @@ -1,95 +0,0 @@ -use std::ffi::OsString; - -use anyhow::anyhow; -use nonempty::NonEmpty; - -use radicle::cob; -use radicle::cob::issue; -use radicle::prelude::Did; -use radicle::storage::WriteStorage; - -use crate::git::Rev; -use crate::terminal as term; -use crate::terminal::args::{string, Args, Error, Help}; - -pub const HELP: Help = Help { - name: "assign", - description: "Assign an issue", - version: env!("CARGO_PKG_VERSION"), - usage: r#" -Usage - - rad assign --to [