avatar module launched even if missing memeber
This commit is contained in:
parent
27f6210669
commit
48e80c5d18
82
src/main.rs
82
src/main.rs
|
@ -75,29 +75,53 @@ fn main() {
|
||||||
Commands::Set { members, discord, fedi } => {
|
Commands::Set { members, discord, fedi } => {
|
||||||
res = set_member(config_path.clone(), members);
|
res = set_member(config_path.clone(), members);
|
||||||
|
|
||||||
#[cfg(feature = "avatar")]
|
#[cfg(feature = "avatar")] {
|
||||||
let _ = update_avatars(config_path.clone(), discord, fedi);
|
match res {
|
||||||
|
Ok(_) => {
|
||||||
|
let _ = update_avatars(config_path.clone(), discord, fedi);
|
||||||
|
},
|
||||||
|
Err(_) => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
#[cfg(all(feature = "discord", not(feature = "fedi")))]
|
#[cfg(all(feature = "discord", not(feature = "fedi")))]
|
||||||
Commands::Set { members, discord } => {
|
Commands::Set { members, discord } => {
|
||||||
res = set_member(config_path.clone(), members);
|
res = set_member(config_path.clone(), members);
|
||||||
|
|
||||||
#[cfg(feature = "avatar")]
|
#[cfg(feature = "avatar")] {
|
||||||
let _ = update_avatars(config_path.clone(), discord, false);
|
match res {
|
||||||
|
Ok(_) => {
|
||||||
|
let _ = update_avatars(config_path.clone(), discord, false);
|
||||||
|
},
|
||||||
|
Err(_) => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
#[cfg(all(not(feature = "discord"), feature = "fedi"))]
|
#[cfg(all(not(feature = "discord"), feature = "fedi"))]
|
||||||
Commands::Set { members, fedi} => {
|
Commands::Set { members, fedi} => {
|
||||||
res = set_member(config_path.clone(), members);
|
res = set_member(config_path.clone(), members);
|
||||||
|
|
||||||
#[cfg(feature = "avatar")]
|
#[cfg(feature = "avatar")] {
|
||||||
let _ = update_avatars(config_path.clone(), false, fedi);
|
match res {
|
||||||
|
Ok(_) => {
|
||||||
|
let _ = update_avatars(config_path.clone(), false, fedi);
|
||||||
|
},
|
||||||
|
Err(_) => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
#[cfg(all(not(feature = "discord"), not(feature = "fedi")))]
|
#[cfg(all(not(feature = "discord"), not(feature = "fedi")))]
|
||||||
Commands::Set { members } => {
|
Commands::Set { members } => {
|
||||||
res = set_member(config_path.clone(), members);
|
res = set_member(config_path.clone(), members);
|
||||||
|
|
||||||
#[cfg(feature = "avatar")]
|
#[cfg(feature = "avatar")] {
|
||||||
let _ = update_avatars(config_path.clone(), false, false);
|
match res {
|
||||||
|
Ok(_) => {
|
||||||
|
let _ = update_avatars(config_path.clone(), false, false);
|
||||||
|
},
|
||||||
|
Err(_) => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// ADD MEMBER
|
// ADD MEMBER
|
||||||
|
@ -105,29 +129,53 @@ fn main() {
|
||||||
Commands::Add { members, discord, fedi } => {
|
Commands::Add { members, discord, fedi } => {
|
||||||
res = add_member(config_path.clone(), members);
|
res = add_member(config_path.clone(), members);
|
||||||
|
|
||||||
#[cfg(feature = "avatar")]
|
#[cfg(feature = "avatar")] {
|
||||||
let _ = update_avatars(config_path.clone(), discord, fedi);
|
match res {
|
||||||
|
Ok(_) => {
|
||||||
|
let _ = update_avatars(config_path.clone(), discord, fedi);
|
||||||
|
},
|
||||||
|
Err(_) => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
#[cfg(all(feature = "discord", not(feature = "fedi")))]
|
#[cfg(all(feature = "discord", not(feature = "fedi")))]
|
||||||
Commands::Add { members, discord } => {
|
Commands::Add { members, discord } => {
|
||||||
res = add_member(config_path.clone(), members);
|
res = add_member(config_path.clone(), members);
|
||||||
|
|
||||||
#[cfg(feature = "avatar")]
|
#[cfg(feature = "avatar")] {
|
||||||
let _ = update_avatars(config_path.clone(), discord, false);
|
match res {
|
||||||
|
Ok(_) => {
|
||||||
|
let _ = update_avatars(config_path.clone(), discord, false);
|
||||||
|
},
|
||||||
|
Err(_) => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
#[cfg(all(not(feature = "discord"), feature = "fedi"))]
|
#[cfg(all(not(feature = "discord"), feature = "fedi"))]
|
||||||
Commands::Add { members, fedi} => {
|
Commands::Add { members, fedi} => {
|
||||||
res = add_member(config_path.clone(), members);
|
res = add_member(config_path.clone(), members);
|
||||||
|
|
||||||
#[cfg(feature = "avatar")]
|
#[cfg(feature = "avatar")] {
|
||||||
let _ = update_avatars(config_path.clone(), false, fedi);
|
match res {
|
||||||
|
Ok(_) => {
|
||||||
|
let _ = update_avatars(config_path.clone(), false, fedi);
|
||||||
|
},
|
||||||
|
Err(_) => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
#[cfg(all(not(feature = "discord"), not(feature = "fedi")))]
|
#[cfg(all(not(feature = "discord"), not(feature = "fedi")))]
|
||||||
Commands::Add { members } => {
|
Commands::Add { members } => {
|
||||||
res = add_member(config_path.clone(), members);
|
res = add_member(config_path.clone(), members);
|
||||||
|
|
||||||
#[cfg(feature = "avatar")]
|
#[cfg(feature = "avatar")] {
|
||||||
let _ = update_avatars(config_path.clone(), false, false);
|
match res {
|
||||||
|
Ok(_) => {
|
||||||
|
let _ = update_avatars(config_path.clone(), false, false);
|
||||||
|
},
|
||||||
|
Err(_) => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Get MEMBER
|
// Get MEMBER
|
||||||
|
@ -270,6 +318,7 @@ fn set_member(config_path: String, tf_members: Vec<String>) -> Result<(), &'stat
|
||||||
println!("One or more members were not found. Known members:\n--------------------------");
|
println!("One or more members were not found. Known members:\n--------------------------");
|
||||||
let _ = memberlist(config_path);
|
let _ = memberlist(config_path);
|
||||||
println!("--------------------------\nIf a member is missing from the system try running \"pluralsync sync\" to refresh the local database");
|
println!("--------------------------\nIf a member is missing from the system try running \"pluralsync sync\" to refresh the local database");
|
||||||
|
return Err("Missing member");
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -307,6 +356,7 @@ fn add_member(config_path: String, tf_members: Vec<String>) -> Result<(), &'stat
|
||||||
println!("One or more members were not found. Known members:\n--------------------------");
|
println!("One or more members were not found. Known members:\n--------------------------");
|
||||||
let _ = memberlist(config_path);
|
let _ = memberlist(config_path);
|
||||||
println!("--------------------------\nIf a member is missing from the system try running \"pluralsync sync\" to refresh the local database");
|
println!("--------------------------\nIf a member is missing from the system try running \"pluralsync sync\" to refresh the local database");
|
||||||
|
return Err("Missing member");
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue