radicle_cli/commands/fork/
args.rs1use radicle::identity::RepoId;
2
3const ABOUT: &str = "Create a fork of a repository
4
5This command is deprecated and will be removed.
6
7Instead of using `rad fork`, use `git push` to push any references to
8your own namespace of a Radicle repository. Usually
9
10 git push rad main
11
12would suffice to push the default branch (here named 'main').
13";
14
15#[derive(Debug, clap::Parser)]
16#[command(about = ABOUT, disable_version_flag = true)]
17pub struct Args {
18 #[arg(value_name = "RID")]
22 pub(super) rid: Option<RepoId>,
23}
24
25#[cfg(test)]
26mod test {
27 use super::Args;
28 use clap::error::ErrorKind;
29 use clap::Parser;
30
31 #[test]
32 fn should_parse_rid_non_urn() {
33 let args = Args::try_parse_from(["fork", "z3Tr6bC7ctEg2EHmLvknUr29mEDLH"]);
34 assert!(args.is_ok())
35 }
36
37 #[test]
38 fn should_parse_rid_urn() {
39 let args = Args::try_parse_from(["fork", "rad:z3Tr6bC7ctEg2EHmLvknUr29mEDLH"]);
40 assert!(args.is_ok())
41 }
42
43 #[test]
44 fn should_not_parse_rid_url() {
45 let err =
46 Args::try_parse_from(["fork", "rad://z3Tr6bC7ctEg2EHmLvknUr29mEDLH"]).unwrap_err();
47 assert_eq!(err.kind(), ErrorKind::ValueValidation);
48 }
49}