| 229 | } |
| 230 | |
| 231 | fn print_authentication_section(has_token: bool, session: Option<&SessionPayload>) { |
| 232 | let Some(session) = session else { |
| 233 | if has_token { |
| 234 | info!( |
| 235 | " {} Token expired (run {} to re-authenticate)", |
| 236 | cross_mark(), |
| 237 | style("codspeed auth login").cyan() |
| 238 | ); |
| 239 | } else { |
| 240 | info!( |
| 241 | " {} Not logged in (run {} to authenticate)", |
| 242 | cross_mark(), |
| 243 | style("codspeed auth login").cyan() |
| 244 | ); |
| 245 | } |
| 246 | return; |
| 247 | }; |
| 248 | |
| 249 | if let Some(user) = &session.user { |
| 250 | info!( |
| 251 | " {} Logged in as {} ({})", |
| 252 | check_mark(), |
| 253 | style(&user.login).bold(), |
| 254 | user.provider |
| 255 | ); |
| 256 | } else { |
| 257 | // Repo-bound, non-user token (automation today, repo tokens later). |
| 258 | info!(" {} Authenticated", check_mark()); |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | /// Render the repository section. Returns whether the local-runs fallback |
| 263 | /// warning should be printed. |