forked from rust-lang/team
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show Zulip details in 'show-person'.
Show `zulip_id` if present. In addition, if ZULIP_USER and ZULIP_TOKEN are set, try to look up the user's name (as shown in Zulip itself). This is useful for finding people whose Zulip name differs from their GitHub name.
- Loading branch information
1 parent
b465f42
commit 2cd7457
Showing
2 changed files
with
36 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ const USER_AGENT: &str = "https://github.com/rust-lang/team ([email protected] | |
|
||
use data::Data; | ||
use schema::{Email, Team, TeamKind}; | ||
use zulip::ZulipApi; | ||
|
||
use crate::schema::RepoPermission; | ||
use anyhow::{bail, format_err, Error}; | ||
|
@@ -292,8 +293,23 @@ fn run() -> Result<(), Error> { | |
println!(); | ||
|
||
println!("github: @{}", person.github()); | ||
if let Some(zulip_id) = person.zulip_id() { | ||
let zulip = ZulipApi::new(); | ||
match zulip.require_auth() { | ||
Ok(()) => match zulip.get_user(zulip_id) { | ||
Ok(user) => println!("zulip: {} ({zulip_id})", user.name), | ||
Err(err) => { | ||
println!("zulip_id: {zulip_id} # Failed to look up Zulip name: {err}") | ||
} | ||
}, | ||
Err(err) => { | ||
// We have no authentication credentials, so don't even attempt the network access. | ||
println!("zulip_id: {zulip_id} # Skipped name lookup: {err}"); | ||
} | ||
} | ||
} | ||
if let Email::Present(email) = person.email() { | ||
println!("email: {}", email); | ||
println!("email: {}", email); | ||
} | ||
println!(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters