Compare commits

..

10 commits

Author SHA1 Message Date
e231352009
change: Rename just file
Some checks failed
Write changelog / write-changelog (push) Successful in 5s
CI / Rust format (push) Successful in 1m15s
CI / Rust check (push) Successful in 5m39s
CI / Rust clippy (push) Failing after 5m35s
CI / Rust build (push) Successful in 7m27s
2024-03-17 06:59:42 +03:00
f6aff22bb1
chore: Update contributing guide 2024-03-17 06:59:42 +03:00
6163c3ff26
refactor: Move from GitHub to Forgejo 2024-03-17 06:59:37 +03:00
031a8a8cf5
chore: Change Awiteb email 2024-03-15 06:06:49 +03:00
2aae3d35f9
chore: Add git-cliff and git-sumi configrations 2024-03-15 06:02:18 +03:00
TheAwiteb
fa42826085
Bump version to 1.2.1
Some checks failed
CD / release (push) Has been cancelled
2024-01-07 22:17:11 +03:00
TheAwiteb
1474bc9fe3
Support null bitwarden login, username and password 2024-01-07 22:16:39 +03:00
TheAwiteb
bfc6f74f4d
Bump version to 1.2.0
Some checks failed
CD / release (push) Has been cancelled
2024-01-07 21:52:09 +03:00
TheAwiteb
084ab77290
Fix the new update check 2024-01-07 21:51:22 +03:00
TheAwiteb
2de0f65728
Bump version to 1.1.0
Some checks failed
CD / release (push) Has been cancelled
2024-01-03 15:58:49 +03:00
37 changed files with 435 additions and 147 deletions

View file

@ -2,32 +2,28 @@
name: Bug
about: Create a bug report to help us improve Lprs
title: '[Bug]: ...'
labels: ["🐞 Bug"]
labels: ["Kind/Bug"]
assignees: ''
---
## Checks
* [ ] I added a descriptive title to this issue
* [ ] I have searched (Google, and GitHub) for similar issues and couldn't find anything
* [ ] I have read [the README](https://github.com/TheAwiteb/lprs/blob/master/README.md) and still think this is a bug
* [ ] I have searched Google for similar issues and couldn't find anything
* [ ] I have read [the README](https://git.4rs.nl/awiteb/lprs/src/branch/master/README.md) and still think this is a bug
## Version
<!-- Report for the bug only if it's present in the latest version of Lprs.
If you are not using the latest version, please update and check if the bug is still present. -->
> Then, run `rustc --version` to get the version of Rust.
Rust version: `...`
<!-- Run `rustc --version` to get the version -->
Rustc version: `...`
<!-- Run `lprs --version` to get the version, and make sure it's the latest one -->
Lprs version: `...`
## Description
<!-- A clear and concise description of what the bug is. -->
## The command
```bash
$ lprs ...
```
## Expected behavior
<!-- A clear and concise description of what you expected to happen. -->

View file

@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for Lprs
title: '[Feature request]: ...'
labels: ["🔥 Feature"]
labels: ["Kind/Feature"]
assignees: ''
---

View file

@ -2,7 +2,7 @@
name: Question
about: Ask a question about Lprs
title: '[Question]: ...'
labels: ["💬 Question"]
labels: ["Kind/Question"]
assignees: ''
---

View file

@ -2,7 +2,7 @@
name: Typo report
about: Report a typo in the documentation or the code
title: '[Typo]: ...'
labels: ["📝 Typo"]
labels: ["Kind/Documentation"]
assignees: ''
---
@ -12,5 +12,5 @@ For the location, please provide a link to the code or the documentation.
| Location | Suggestion |
|----------|------------|
| GitHub-link| Suggestion |
| Code-link| Suggestion |

View file

@ -5,8 +5,8 @@ Make sure to replace `{issue title}` with the title of the issue you are fixing.
-->
## Issue
<!-- Copy the issue link from the issue you are fixing (e.g. https://github.com/TheAwiteb/lprs/issues/1) -->
This will fix {issue GitHub link}
<!-- Copy the issue link from the issue you are fixing (e.g. https://git.4rs.nl/awiteb/lprs/issues/1) -->
This will fix {issue Forgejo link}
## How I am fixing it
<!-- A clear and concise description of how you are fixing the bug. -->

48
.forgejo/workflows/cd.yml Normal file
View file

@ -0,0 +1,48 @@
name: CD
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+
jobs:
release:
runs-on: debian
steps:
- uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0
fetch-tags: true
- name: Install git-cliff
run: |
version="2.1.2"
wget "https://github.com/orhun/git-cliff/releases/download/v$version/git-cliff-$version-x86_64-unknown-linux-gnu.tar.gz"
tar -xvzf git-cliff-*.tar.gz
mv "git-cliff-$version/git-cliff" /usr/local/bin
rm -fr git-cliff-*
- name: Write changelog
run: |
git config user.name forgejo-actions
git config user.email forgejo-actions@noreply.localhost
echo 'TAG_CHANGELOG=$(if [[ $(git tag --sort=committerdate | tail -n 1) == *"-rc"* ]]; then git-cliff --strip all $(git tag --sort=committerdate | tail -n 2 | sed ":a; N; $!ba; s/\n/../g") | sed "s/## unreleased.*$//g"; else git-cliff -l --strip all | sed "s/^## \[.*$//g";fi)' | sed "s/\"/'/g" >> $GITHUB_ENV
if [[ $(git tag --sort=committerdate | tail -n 1) != *'-rc'* ]]; then
echo "The latest tag is not a release candidate, updating changelog for $GITHUB_REF_NAME"
git-cliff > CHANGELOG.md
git add CHANGELOG.md
git commit -m "Update changelog for $GITHUB_REF_NAME"
git push
echo "Changelog updated"
else
echo "The latest tag is a release candidate, not updating changelog"
fi
- name: Create Release
uses: actions/forgejo-release@v1
with:
direction: upload
url: https://git.4rs.nl
token: ${{ env.GITHUB_TOKEN }}
release-dir: release-dir
release-notes: ${{ env.TAG_CHANGELOG }}
prerelease: ${{ contains(env.GITHUB_REF_NAME, '-rc') }}

View file

@ -0,0 +1,36 @@
name: Write changelog
on:
push:
branches:
- 'master'
jobs:
write-changelog:
runs-on: debian
steps:
- uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0
fetch-tags: true
- name: Install git-cliff
run: |
version="2.1.2"
wget "https://github.com/orhun/git-cliff/releases/download/v$version/git-cliff-$version-x86_64-unknown-linux-gnu.tar.gz"
tar -xvzf git-cliff-*.tar.gz
mv "git-cliff-$version/git-cliff" /usr/local/bin
rm -fr git-cliff-*
- name: Write changelog
run: |
git config user.name forgejo-actions
git config user.email forgejo-actions@noreply.localhost
git-cliff > CHANGELOG.md
if [[ $(git status | grep --extended-regexp '^\s+modified:\s+CHANGELOG.md$') ]]; then
git add CHANGELOG.md
git commit -m "chore(changelog): Update changelog"
git push
echo "Changelog updated"
else
echo "No changes to changelog"
fi

38
.forgejo/workflows/ci.yml Normal file
View file

@ -0,0 +1,38 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
name: Rust build
runs-on: debian
steps:
- uses: actions/checkout@v4
- uses: https://codeberg.org/TheAwiteb/rust-action@v1.70
- run: cargo build
rustfmt:
name: Rust format
runs-on: debian
steps:
- uses: actions/checkout@v4
- uses: https://codeberg.org/TheAwiteb/rust-action@v1.70
- run: cargo fmt -- --check
check:
name: Rust check
runs-on: debian
steps:
- uses: actions/checkout@v4
- uses: https://codeberg.org/TheAwiteb/rust-action@v1.70
- run: cargo check
clippy:
name: Rust clippy
runs-on: debian
steps:
- uses: actions/checkout@v4
- uses: https://codeberg.org/TheAwiteb/rust-action@v1.70
- run: cargo clippy -- -D warnings

View file

@ -0,0 +1,18 @@
on:
pull_request:
types:
- opened
- edited
- reopened
jobs:
main:
runs-on: debian
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- run: |
curl -L "https://github.com/welpo/git-sumi/releases/download/v0.0.6/git-sumi-x86_64-unknown-linux-gnu.tar.xz" -o git-sumi.tar.xz
tar -xf git-sumi.tar.xz
mv git-sumi-x86_64-unknown-linux-gnu/git-sumi git-sumi
chmod +x git-sumi
./git-sumi "${{ github.event.pull_request.title }}"

1
.github/FUNDING.yml vendored
View file

@ -1 +0,0 @@
github: "TheAwiteb"

34
.github/workflows/auto_close_pr.yml vendored Normal file
View file

@ -0,0 +1,34 @@
name: Auto close PR
on:
pull_request:
types: [opened, reopened]
jobs:
close_pr:
name: Auto close PR
runs-on: ubuntu-latest
steps:
- name: Send close comment
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $PAT" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/comments \
-d '{"body":"${{ env.BODY }}"}'
env:
PAT: ${{ secrets.PAT }}
BODY: This repository is mirror only and you cannot create a pull request for it. Please open your PR at https://git.4rs.nl/awiteb/lprs
- name: Close the PR
run: |
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $PAT" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }} \
-d '{"state":"closed"}'
env:
PAT: ${{ secrets.PAT }}

View file

@ -1,26 +0,0 @@
name: CD
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
jobs:
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- name: Create Release 🖋
uses: softprops/action-gh-release@v1
with:
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'pre') }}
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Publish to crates.io 🚀
uses: katyo/publish-crates@v2
with:
token: ${{ secrets.PAT }}
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

View file

@ -1,50 +0,0 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
name: Rust build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --workspace --all-features
rustfmt:
name: Rust format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo fmt -- --check
check:
name: Rust check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo check --workspace --all-features
clippy:
name: Rust clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo clippy --workspace --all-features -- -D warnings
verify_msrv:
name: Verify Minimum Supported Rust Version in Cargo.toml
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install or use cached `cargo-msrv`
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-msrv
- name: Verify Minimum Rust Version
run: cargo-msrv verify

View file

@ -2,21 +2,53 @@
Thank you for your interest in contributing to lprs! We welcome contributions from the community to help improve the project.
## Getting Started
## Reporting Issues
To get started with contributing to lprs, please follow these steps:
If you encounter any issues or bugs while using lprs, please open a new issue on the Forgejo repository. When reporting an issue, please provide as much detail as possible, including steps to reproduce the issue and any relevant error messages.
1. Fork the lprs repository to your own GitHub account.
2. Clone the forked repository to your local machine.
3. Create a new branch for your changes: `git checkout -b my-branch-name`.
4. Make your desired changes to the codebase.
5. Test your changes to ensure they work as expected.
6. Run `just ci` to run the continuous integration.
7. Commit your changes: `git commit -m "Add my changes"`.
8. Push your changes to your forked repository: `git push origin my-branch-name`.
9. Open a pull request from your forked repository to the main lprs repository.
## Feature Requests
## Code Style
If you have a feature request or an idea for improving lprs, we encourage you to open a new issue on the Forgejo repository. Please describe the feature or improvement in detail and provide any relevant context or examples.
## Writing Code
Before you start writing code, please open a new issue first to discuss the proposed changes. This will help ensure that your contribution is aligned with the project's goals and that you are not duplicating work that is already in progress or has been completed by someone else.
### PR title
Your PR will squash and merge, and your PR title will be used as the commit message. Please make sure your PR title is clear and concise.
The title must follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format. This means that the title should be in the following format:
```
<type>(<scope>): <description>
```
- The `<scope>` is optional, and the `<description>` should be a clear and concise summary of the changes.
- You should use the imperative, present tense (e.g., "Add feature" instead of "Added feature").
- The `<type>` should be one of the following:
- `feat`: A new feature
- `fix`: A bug fix
- `docs`: Documentation changes
- `refactor`: Refactoring code without changing its behavior
- `change`: Changes that affect the meaning of the code
- `deprecate`: Changes that deprecate a part of the code
- `remove`: Changes that remove a deprecated part of the code
- `security`: Changes that affect the security of the code
- `perf`: A code change that improves performance
- `test`: Adding missing tests or correcting existing tests
- `chore`: Changes to the build process or auxiliary tools and libraries such as documentation generation
#### Example
```
- feat: something
- chore(ci): update MSRV
```
### PR description
Your PR description should provide a clear and concise summary of the changes you have made. It should also include any relevant context or background information that will help the project maintainers understand the purpose of the changes. Make sure to reference the issue that your PR is addressing, and note any breaking changes that your PR introduces.
Make sure to explain why you made the changes not just what changes you made.
### Code Style
Please follow the existing code style and conventions used in the lprs project. This includes:
@ -24,13 +56,14 @@ Please follow the existing code style and conventions used in the lprs project.
- Writing clear and concise code with meaningful variable and function names.
- Adding comments to explain complex logic or algorithms.
## Reporting Issues
### CI
Run the CI before submitting your code. You can run the CI with the following command:
If you encounter any issues or bugs while using lprs, please open a new issue on the GitHub repository. When reporting an issue, please provide as much detail as possible, including steps to reproduce the issue and any relevant error messages.
```bash
just ci
```
## Feature Requests
If you have a feature request or an idea for improving lprs, we encourage you to open a new issue on the GitHub repository. Please describe the feature or improvement in detail and provide any relevant context or examples.
This will run the tests and check the code formatting. If the CI fail, please fix the issues before submitting your code.
## Code Review

2
Cargo.lock generated
View file

@ -731,7 +731,7 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "lprs"
version = "1.0.0"
version = "1.2.1"
dependencies = [
"base64",
"clap",

View file

@ -1,12 +1,12 @@
[package]
name = "lprs"
version = "1.0.0"
version = "1.2.1"
edition = "2021"
license = "GPL-3.0-only"
authors = ["Awiteb <awiteb@hotmail.com>"]
authors = ["Awiteb <a@4rs.nl>"]
readme = "README.md"
description = "A local CLI password manager"
repository = "https://github.com/TheAwiteb/lprs"
repository = "https://git.4rs.nl/awiteb/lprs"
rust-version = "1.70.0"
keywords = ["password", "manager", "CLI"]
categories = ["command-line-utilities"]

View file

@ -1,7 +1,7 @@
# This justfile is for the contrbutors of this project, not for the end user.
#
# Requirements for this justfile:
# - Linux distribution, the real programer does not program on garbage OS like Windows or MacOS
# - Linux distribution
# - just (Of course) <https://github.com/casey/just>
# - cargo (For the build and tests) <https://doc.rust-lang.org/cargo/getting-started/installation.html>

100
cliff.toml Normal file
View file

@ -0,0 +1,100 @@
[changelog]
# changelog header
header = """
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
"""
body = """
{# Check if there is a `BREAKING-CHANGE` footer in the message or not #}\
{% macro is_breaking(commit) %}\
{{"BREAKING-CHANGE" in commit.message}}\
{% endmacro is_breaking %}\
{# Return the commit header #}\
{% macro commit_header(commit) %}\
{{commit.message | split(pat="\n") | nth(n=0) | upper_first }}\
{% endmacro commit_header %}\
{# Return the `BREAKING-CHANGE` footer message, only one line #}\
{% macro bc_des(commit) %}\
{% for line in commit.message | split(pat="\n") %}\
{% if line is starting_with("BREAKING-CHANGE") %}\
{{line | split(pat=":") | nth(n=1) | split(pat="\n") | nth(n=0)}}\
{% endif %}\
{% endfor %}\
{% endmacro bc_des %}\
{% if version %}\
{% if previous.version %}\
## [{{ version | trim_start_matches(pat="v") }}](<REPO>/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }}
{% endif %}\
{% else %}\
## unreleased
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}\
### {{ group | upper_first }}
{% for commit in commits | sort(attribute="message") %}\
- {{ self::commit_header(commit=commit) }} ([`{{ commit.id | truncate(length=7, end="") }}`](<REPO>/commit/{{ commit.id }}))
{% if self::is_breaking(commit=commit) == "true" %}\
\t- **BC**: {{self::bc_des(commit=commit)}}
{% endif %}\
{% endfor %}\
{% endfor %}\n
"""
# remove the leading and trailing whitespace from the template
trim = true
# changelog footer
footer = """
This changelog was generated by [git-cliff](https://github.com/orhun/git-cliff)
"""
# postprocessors
postprocessors = [
{pattern = '<REPO>', replace = "https://git.4rs.nl/awiteb/lprs"}, # replace repository URL
{pattern = '- \((\w+)\):', replace = "- (**$1**)"}, # Make the scope blod
{pattern = "\t", replace = " "}, # Replace tap with 4 spaces
]
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
{pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([**#${2}**](<REPO>/issues/${2}))"}, # replace issue numbers (Note the PR is also an issue in GitHub, so this will also link to PRs)
{pattern = ' +$', replace = ""}, # Remove trailing whitespace.
{pattern = ' +', replace = " "}, # Replace multiple spaces with a single space.
]
# regex for parsing and grouping commits
commit_parsers = [
# Gitmoji
{message = "^feat", group = "Added"},
{message = "^fix", group = "Fixed"},
{message = "^(refactor|change)", group = "Changed"},
{message = "^deprecate", group = "Deprecated"},
{message = "^remove", group = "Removed"},
{message = "^security", group = "Security"},
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# regex for matching git tags
tag_pattern = "v[0-9]+\\.[0-9]+\\.[0-9]+"
# regex for skipping tags
skip_tags = ""
# regex for ignoring tags
ignore_tags = "v[0-9]+\\.[0-9]+\\.[0-9]+-(alpha|beta|rc)(\\.[0-9]+)?"
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -47,11 +47,11 @@ fn main() -> ExitCode {
#[cfg(feature = "update-notify")]
{
match utils::lprs_version() {
Ok(Some(new_version)) if new_version == VERSION => {
Ok(Some(new_version)) if new_version != VERSION => {
println!(
"Warning: The version you are using of lprs is outdated. There is a newer version, which is `{new_version}`, and your version is `{VERSION}`
\rYou can update via: `cargo install lprs --locked`
\rOr via git repo: `cargo install --locked --git https://github.com/TheAwiteb/lprs.git`
\rOr via git repo: `cargo install --locked --git https://git.4rs.nl/awiteb/lprs.git`
\rTo disable update notification: `cargo install lprs --locked --no-default-features`\n\n"
)
}

View file

@ -4,8 +4,8 @@ use super::{Password, Passwords};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BitWardenLoginData {
pub username: String,
pub password: String,
pub username: Option<String>,
pub password: Option<String>,
pub uris: Option<Vec<BitWardenUri>>,
}
@ -27,7 +27,7 @@ pub struct BitWardenPassword {
#[serde(rename = "type")]
pub ty: i32,
pub name: String,
pub login: BitWardenLoginData,
pub login: Option<BitWardenLoginData>,
pub notes: Option<String>,
}
@ -43,12 +43,17 @@ impl From<BitWardenPassword> for Password {
fn from(value: BitWardenPassword) -> Self {
Self {
name: value.name,
username: value.login.username,
password: value.login.password,
username: value
.login
.as_ref()
.map_or_else(String::new, |l| l.username.to_owned().unwrap_or_default()),
password: value
.login
.as_ref()
.map_or_else(String::new, |l| l.password.to_owned().unwrap_or_default()),
service: value
.login
.uris
.and_then(|p| p.first().map(|u| u.uri.clone())),
.and_then(|l| l.uris.and_then(|p| p.first().map(|u| u.uri.clone()))),
note: value.notes,
}
}
@ -59,13 +64,13 @@ impl From<Password> for BitWardenPassword {
Self {
ty: 1,
name: value.name,
login: BitWardenLoginData {
username: value.username,
password: value.password,
login: Some(BitWardenLoginData {
username: Some(value.username),
password: Some(value.password),
uris: value
.service
.map(|s| vec![BitWardenUri { mt: None, uri: s }]),
},
}),
notes: value.note,
}
}

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
// Lprs - A local CLI password manager
// Copyright (C) 2024 Awiteb
// Copyright (C) 2024 Awiteb <a@4rs.nl>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -67,7 +67,7 @@ pub fn lprs_version() -> LprsResult<Option<String>> {
.get("https://crates.io/api/v1/crates/lprs")
.header(
"User-Agent",
format!("Lprs <{current_time}> (https://github.com/theawiteb/lprs)"),
format!("Lprs <{current_time}> (https://git.4rs.nl/awiteb/lprs)"),
)
.send()
.map(|r| r.text())

57
sumi.toml Normal file
View file

@ -0,0 +1,57 @@
# git-sumi ~ configuration file
# Config: https://sumi.rs/docs/configuration
# Rules: https://sumi.rs/docs/rules
# Suppresses progress messages.
quiet = false
# Displays parsed commit message.
display = true
# Sets display format: cli, json, table, toml.
format = "cli"
# Processes each non-empty line as an individual commit.
split_lines = false
# Rule: Include one valid Gitmoji.
# See https://gitmoji.dev/.
gitmoji = false
# Rule: Description must start with the specified case.
# Options: 'any', 'lower', 'upper'.
description_case = "any"
# Rule: Use the imperative mood in the description.
# Example: 'Fix bug' instead of 'Fixed bug'.
imperative = true
# Rule: Do not end commit header with a period.
no_period = true
# Rule: Header length limit.
# A value of 0 disables the rule.
max_header_length = 55
# Rule: Body line length limit.
# A value of 0 disables the rule.
max_body_length = 80
# Rule: No leading, trailing, or consecutive spaces.
whitespace = true
# Rule: Follow Conventional Commits format.
# See https://www.conventionalcommits.org/.
conventional = true
# Rule: List of allowed commit scopes.
# An empty list allows all scopes. Example: ["docs", "cli"].
scopes_allowed = []
# Rule: List of allowed commit types.
# An empty list allows all types. Example: ["feat", "fix", "docs"].
types_allowed = ["feat", "fix", "docs", "refactor", "change", "deprecate", "remove", "security", "perf", "test", "chore"]
# Rule: Header must match regex pattern.
# Example: '^JIRA-\d+:'.
header_pattern = '^\w+(\s\(\w+\))?(!)?: \w'