From 6d53f416836d947d1d4dcf957ffb9f00dc7b3c3c Mon Sep 17 00:00:00 2001 From: Danil Akhtarov Date: Fri, 3 Nov 2023 21:57:24 +0300 Subject: [PATCH] feat: support for windows --- .github/workflows/ci.yml | 6 +++--- src/commands/pwd.rs | 2 +- src/commands/totp.rs | 2 +- src/keyring.rs | 11 +++++++++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fbcf92..11117d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: name: Check strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout sources @@ -34,7 +34,7 @@ jobs: name: Test Suite strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout sources @@ -56,7 +56,7 @@ jobs: name: Lints strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout sources diff --git a/src/commands/pwd.rs b/src/commands/pwd.rs index fd44c8a..3b3e843 100644 --- a/src/commands/pwd.rs +++ b/src/commands/pwd.rs @@ -98,7 +98,7 @@ fn clip(entry: &Entry, timeout: u8) -> Result<()> { if set_clipboard(Some(pwd.to_string())).is_err() { return Err(format!( - "Clipboard unavailable. Try use STDOUT, i.e. `kdbx clip '{}' | cat`.", + "Clipboard unavailable. Try use STDOUT, i.e. `kdbx pwd '{}' | cat`.", entry.get_title().unwrap_or_default() ) .into()); diff --git a/src/commands/totp.rs b/src/commands/totp.rs index 301f88f..a6aee7f 100644 --- a/src/commands/totp.rs +++ b/src/commands/totp.rs @@ -95,7 +95,7 @@ pub(crate) fn run(args: Args) -> Result<()> { fn clip(entry: &Entry, raw: bool) -> Result<()> { if set_clipboard(Some(get_totp(entry, raw))).is_err() { return Err(format!( - "Clipboard unavailable. Try use STDOUT, i.e. `kdbx clip '{}' | cat`.", + "Clipboard unavailable. Try use STDOUT, i.e. `kdbx totp '{}' | cat`.", entry.get_title().unwrap_or_default() ) .into()); diff --git a/src/keyring.rs b/src/keyring.rs index 63b1975..322399d 100644 --- a/src/keyring.rs +++ b/src/keyring.rs @@ -194,3 +194,14 @@ impl fmt::Display for Keyring { write!(f, "description: {})", self.desc.to_string_lossy()) } } + +#[cfg(target_os = "windows")] +#[derive(Display)] +pub struct Keyring; + +#[cfg(target_os = "windows")] +impl Keyring { + fn new(keyname: String, account: String) -> Result { + Err("unimplemented") + } +}