Format code

This commit is contained in:
Marcin Kulik
2025-05-07 11:30:17 +02:00
parent c62bbc70fb
commit ebc4b3b12b

View File

@@ -4,6 +4,7 @@ use std::io::ErrorKind;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use anyhow::{anyhow, bail, Result}; use anyhow::{anyhow, bail, Result};
use config::{self, Environment, File};
use reqwest::Url; use reqwest::Url;
use serde::Deserialize; use serde::Deserialize;
use uuid::Uuid; use uuid::Uuid;
@@ -97,14 +98,10 @@ impl Config {
.set_default("cmd.stream.rec_input", false)? .set_default("cmd.stream.rec_input", false)?
.set_default("cmd.session.rec_input", false)? .set_default("cmd.session.rec_input", false)?
.set_default("notifications.enabled", true)? .set_default("notifications.enabled", true)?
.add_source(config::File::with_name("/etc/asciinema/config.toml").required(false)) .add_source(File::with_name("/etc/asciinema/config.toml").required(false))
.add_source( .add_source(File::with_name(&user_defaults_path()?.to_string_lossy()).required(false))
config::File::with_name(&user_defaults_path()?.to_string_lossy()).required(false), .add_source(File::with_name(&user_config_path()?.to_string_lossy()).required(false))
) .add_source(Environment::with_prefix("asciinema").separator("_"));
.add_source(
config::File::with_name(&user_config_path()?.to_string_lossy()).required(false),
)
.add_source(config::Environment::with_prefix("asciinema").separator("_"));
if let Some(url) = server_url { if let Some(url) = server_url {
config = config.set_override("server.url", Some(url))?; config = config.set_override("server.url", Some(url))?;
@@ -209,11 +206,12 @@ impl Play {
fn ask_for_server_url() -> Result<String> { fn ask_for_server_url() -> Result<String> {
println!("No asciinema server configured for this CLI."); println!("No asciinema server configured for this CLI.");
let mut rl = rustyline::DefaultEditor::new()?;
let url = rl.readline_with_initial( let url = rustyline::DefaultEditor::new()?.readline_with_initial(
"Enter the server URL to use by default: ", "Enter the server URL to use by default: ",
(DEFAULT_SERVER_URL, ""), (DEFAULT_SERVER_URL, ""),
)?; )?;
println!(); println!();
Ok(url) Ok(url)