mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 11:00:36 +00:00
fix: listen for device flow completion without requiring enter
This commit is contained in:
parent
051e062c39
commit
14aeabeed2
2 changed files with 16 additions and 12 deletions
|
@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
## [Unreleased]
|
||||
### Fixed
|
||||
- Use updated aliases when reusing lockfile dependencies by @daimond113
|
||||
- Listen for device flow completion without requiring pressing enter by @daimond113
|
||||
|
||||
## [0.5.0-rc.6] - 2024-10-14
|
||||
### Added
|
||||
|
|
|
@ -2,6 +2,7 @@ use anyhow::Context;
|
|||
use clap::Args;
|
||||
use colored::Colorize;
|
||||
use serde::Deserialize;
|
||||
use std::thread::spawn;
|
||||
use url::Url;
|
||||
|
||||
use pesde::{
|
||||
|
@ -81,19 +82,21 @@ impl LoginCommand {
|
|||
response.verification_uri.as_str().blue()
|
||||
);
|
||||
|
||||
{
|
||||
let mut input = String::new();
|
||||
std::io::stdin()
|
||||
.read_line(&mut input)
|
||||
.context("failed to read input")?;
|
||||
}
|
||||
|
||||
match open::that(response.verification_uri.as_str()) {
|
||||
Ok(_) => (),
|
||||
Err(e) => {
|
||||
eprintln!("failed to open browser: {e}");
|
||||
spawn(move || {
|
||||
{
|
||||
let mut input = String::new();
|
||||
std::io::stdin()
|
||||
.read_line(&mut input)
|
||||
.expect("failed to read input");
|
||||
}
|
||||
}
|
||||
|
||||
match open::that(response.verification_uri.as_str()) {
|
||||
Ok(_) => (),
|
||||
Err(e) => {
|
||||
eprintln!("failed to open browser: {e}");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let mut time_left = response.expires_in;
|
||||
let mut interval = std::time::Duration::from_secs(response.interval);
|
||||
|
|
Loading…
Reference in a new issue