From 508c8b7feb58f14b2c5d474a6aeca3731cc4f9af Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Tue, 30 Sep 2025 15:40:27 -0600 Subject: [PATCH] style: Reformatted code --- src/bin/gman/cli.rs | 4 ++-- src/bin/gman/main.rs | 6 +++--- src/config.rs | 23 ++++++++++------------- src/providers/local.rs | 14 +++++++------- 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/bin/gman/cli.rs b/src/bin/gman/cli.rs index b83d9ae..d8432f5 100644 --- a/src/bin/gman/cli.rs +++ b/src/bin/gman/cli.rs @@ -1,8 +1,8 @@ use crate::command::preview_command; -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; use clap_complete::CompletionCandidate; use futures::future::join_all; -use gman::config::{load_config, Config, RunConfig}; +use gman::config::{Config, RunConfig, load_config}; use log::{debug, error}; use regex::Regex; use std::collections::HashMap; diff --git a/src/bin/gman/main.rs b/src/bin/gman/main.rs index 21d1531..73175ad 100644 --- a/src/bin/gman/main.rs +++ b/src/bin/gman/main.rs @@ -4,12 +4,12 @@ use crate::cli::secrets_completer; use anyhow::{Context, Result}; use clap::Subcommand; use clap::{ - crate_authors, crate_description, crate_name, crate_version, CommandFactory, Parser, ValueEnum, + CommandFactory, Parser, ValueEnum, crate_authors, crate_description, crate_name, crate_version, }; use clap_complete::{ArgValueCompleter, CompleteEnv}; use crossterm::execute; -use crossterm::terminal::{disable_raw_mode, LeaveAlternateScreen}; -use gman::config::{get_config_file_path, load_config, Config}; +use crossterm::terminal::{LeaveAlternateScreen, disable_raw_mode}; +use gman::config::{Config, get_config_file_path, load_config}; use std::ffi::OsString; use std::io::{self, IsTerminal, Read, Write}; use std::panic::PanicHookInfo; diff --git a/src/config.rs b/src/config.rs index 314eb93..bda5fa9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -300,13 +300,11 @@ pub fn load_config(interpolate: bool) -> Result { let yaml = app_dir.join("config.yaml"); if yml.exists() || yaml.exists() { let load_path = if yml.exists() { &yml } else { &yaml }; - let mut content = - fs::read_to_string(load_path).with_context(|| { - format!("failed to read config file '{}'", load_path.display()) - })?; - if interpolate { - content = interpolate_env_vars(&content); - } + let mut content = fs::read_to_string(load_path) + .with_context(|| format!("failed to read config file '{}'", load_path.display()))?; + if interpolate { + content = interpolate_env_vars(&content); + } let cfg: Config = serde_yaml::from_str(&content).with_context(|| { format!("failed to parse YAML config at '{}'", load_path.display()) })?; @@ -340,12 +338,11 @@ pub fn load_config(interpolate: bool) -> Result { fn load_confy_config(interpolate: bool) -> Result { let load_path = confy::get_configuration_file_path("gman", "config")?; - let mut content = - fs::read_to_string(&load_path) - .with_context(|| format!("failed to read config file '{}'", load_path.display()))?; - if interpolate { - content = interpolate_env_vars(&content); - } + let mut content = fs::read_to_string(&load_path) + .with_context(|| format!("failed to read config file '{}'", load_path.display()))?; + if interpolate { + content = interpolate_env_vars(&content); + } let cfg: Config = serde_yaml::from_str(&content) .with_context(|| format!("failed to parse YAML config at '{}'", load_path.display()))?; diff --git a/src/providers/local.rs b/src/providers/local.rs index b260ae5..9eb7a93 100644 --- a/src/providers/local.rs +++ b/src/providers/local.rs @@ -1,14 +1,14 @@ -use anyhow::{anyhow, bail, Context}; +use anyhow::{Context, anyhow, bail}; use secrecy::{ExposeSecret, SecretString}; use std::collections::HashMap; use std::path::{Path, PathBuf}; use std::{env, fs}; use zeroize::Zeroize; -use crate::config::{get_config_file_path, load_config, Config}; +use crate::config::{Config, get_config_file_path, load_config}; use crate::providers::git_sync::{ - default_git_email, default_git_username, ensure_git_available, repo_name_from_url, resolve_git, - sync_and_push, SyncOpts, + SyncOpts, default_git_email, default_git_username, ensure_git_available, repo_name_from_url, + resolve_git, sync_and_push, }; use crate::providers::{SecretProvider, SupportedProvider}; use crate::{ @@ -16,13 +16,13 @@ use crate::{ }; use anyhow::Result; use argon2::{Algorithm, Argon2, Params, Version}; -use base64::{engine::general_purpose::STANDARD as B64, Engine as _}; +use base64::{Engine as _, engine::general_purpose::STANDARD as B64}; use chacha20poly1305::aead::rand_core::RngCore; use chacha20poly1305::{ - aead::{Aead, KeyInit, OsRng}, Key, XChaCha20Poly1305, XNonce, + aead::{Aead, KeyInit, OsRng}, }; -use dialoguer::{theme, Input}; +use dialoguer::{Input, theme}; use log::{debug, error}; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none;