Commit 87ebd7a6e4
Unsigned
Layout: unified · split
build.rs +5 −2
| @@ -33,12 +33,15 @@ fn main() { | ||
| 33 | 33 | |
| 34 | 34 | // Capture git describe output for the version command |
| 35 | 35 | if let Ok(output) = std::process::Command::new("git") |
| 36 | .args(["describe", "--long", "--tags", "--always", "--all", "--dirty"]) | |
| 36 | .args([ | |
| 37 | "describe", "--long", "--tags", "--always", "--all", "--dirty", | |
| 38 | ]) | |
| 37 | 39 | .current_dir(std::env::var("CARGO_MANIFEST_DIR").unwrap()) |
| 38 | 40 | .output() |
| 39 | 41 | { |
| 40 | 42 | if output.status.success() { |
| 41 | let describe = String::from_utf8_lossy(&output.stdout).trim().to_string(); | |
| 43 | let describe = | |
| 44 | String::from_utf8_lossy(&output.stdout).trim().to_string(); | |
| 42 | 45 | println!("cargo::rustc-env=GIT_DESCRIBE={}", describe); |
| 43 | 46 | println!("cargo::warning=weechat-matrix git describe: {}", describe); |
| 44 | 47 | } else { |
src/commands/access.rs +3 −19
| @@ -36,15 +36,12 @@ impl RoomAccessCommand { | ||
| 36 | 36 | pub fn create(servers: &Servers) -> Result<Command, ()> { |
| 37 | 37 | let settings = CommandSettings::new("room") |
| 38 | 38 | .description("Change access rules for the current Matrix room.") |
| 39 | .add_argument("make_public|make_invite_only") | |
| 40 | 39 | .add_argument("set_join_rule <public|invite|knock|private>") |
| 41 | 40 | .arguments_description( |
| 42 | "make_public: Allow anyone to join the room.\n\ | |
| 43 | make_invite_only: Require an invitation to join.\n\ | |
| 44 | set_join_rule: Set the join rule to public, invite, knock, or private.", | |
| 41 | "set_join_rule: Set the join rule to public, invite, knock, or private.", | |
| 45 | 42 | ) |
| 46 | 43 | .add_completion( |
| 47 | "make_public|make_invite_only|set_join_rule public|invite|knock|private", | |
| 44 | "set_join_rule public|invite|knock|private", | |
| 48 | 45 | ); |
| 49 | 46 | |
| 50 | 47 | Command::new( |
| @@ -61,8 +58,6 @@ impl RoomAccessCommand { | ||
| 61 | 58 | ArgParseSettings::DisableHelpFlags, |
| 62 | 59 | ArgParseSettings::DisableVersion, |
| 63 | 60 | ]) |
| 64 | .subcommand(SubCommand::with_name("make_public")) | |
| 65 | .subcommand(SubCommand::with_name("make_invite_only")) | |
| 66 | 61 | .subcommand( |
| 67 | 62 | SubCommand::with_name("set_join_rule") |
| 68 | 63 | .arg(Arg::with_name("rule").required(true)), |
| @@ -71,8 +66,6 @@ impl RoomAccessCommand { | ||
| 71 | 66 | |
| 72 | 67 | fn action(matches: &clap::ArgMatches) -> Result<AccessAction, String> { |
| 73 | 68 | match matches.subcommand() { |
| 74 | ("make_public", _) => Ok(AccessAction::Public), | |
| 75 | ("make_invite_only", _) => Ok(AccessAction::Invite), | |
| 76 | 69 | ("set_join_rule", Some(args)) => match args.value_of("rule") { |
| 77 | 70 | Some("public") => Ok(AccessAction::Public), |
| 78 | 71 | Some("invite") | Some("invite_only") => Ok(AccessAction::Invite), |
| @@ -84,7 +77,7 @@ impl RoomAccessCommand { | ||
| 84 | 77 | )), |
| 85 | 78 | None => Err("A join rule is required.".to_owned()), |
| 86 | 79 | }, |
| 87 | _ => Err("Usage: /room make_public|make_invite_only|set_join_rule <public|invite|knock|private>".to_owned()), | |
| 80 | _ => Err("Usage: /room set_join_rule <public|invite|knock|private>".to_owned()), | |
| 88 | 81 | } |
| 89 | 82 | } |
| 90 | 83 | |
| @@ -128,15 +121,6 @@ mod tests { | ||
| 128 | 121 | RoomAccessCommand::action(&matches) |
| 129 | 122 | } |
| 130 | 123 | |
| 131 | #[test] | |
| 132 | fn explicit_shortcuts_select_join_rules() { | |
| 133 | assert_eq!(Ok(AccessAction::Public), parse(&["room", "make_public"])); | |
| 134 | assert_eq!( | |
| 135 | Ok(AccessAction::Invite), | |
| 136 | parse(&["room", "make_invite_only"]) | |
| 137 | ); | |
| 138 | } | |
| 139 | ||
| 140 | 124 | #[test] |
| 141 | 125 | fn generic_command_accepts_public_and_invite_rules() { |
| 142 | 126 | assert_eq!( |