Skip to content

Commit

Permalink
feat: anyhow and thiserror
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrutchf committed Nov 17, 2024
1 parent ed62c8a commit 2c25191
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ version = "0.1.0"
edition = "2021"

[dependencies]
anyhow = "1.0.93"
app_dirs2 = "2.5.5"
clap = "4.5.21"
futures-macro = "0.3.31"
keyring = { version = "3.6.1", features = ["apple-native", "windows-native", "sync-secret-service"] }
rusqlite = "0.32.1"
thiserror = "2.0.3"
18 changes: 16 additions & 2 deletions src/credential_manager.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
use keyring::{Entry, Result};
use std::path::PathBuf;

use anyhow::Result;
use keyring::Entry;
use app_dirs2::{AppDataType, AppInfo, app_root};

pub struct Credential {
user: String,
Expand Down Expand Up @@ -32,10 +36,20 @@ impl CredentialManager {
Ok(())
}

fn get_database_path(&self) -> Result<PathBuf> {
let mut path = app_root(AppDataType::UserConfig, &AppInfo{
name: "git-lfs-synology",
author: "Engineers for Exploration"
})?;
path.push("credential_store.db");

Ok(path)
}

fn get_entry_keyring(&self, url: &str) -> Result<Entry> {
let user = "";

Entry::new(url, user)
Ok(Entry::new(url, user)?)
}

fn get_password(&self, url: &str) -> Result<String> {
Expand Down

0 comments on commit 2c25191

Please sign in to comment.