mirror of
https://codeberg.org/tyy/aspm
synced 2024-12-22 21:49:28 -07:00
Use prelude
This commit is contained in:
parent
4f83bb9a3f
commit
db19e9ad69
3 changed files with 8 additions and 8 deletions
|
@ -10,7 +10,7 @@ use std::io::Write;
|
|||
|
||||
use crate::{
|
||||
commands::{AspmSubcommand, KeysEntityExt, KeysQueryResult},
|
||||
entities::keys::{Entity as KeysEntity, Model as KeysModel},
|
||||
entities::prelude::*
|
||||
};
|
||||
|
||||
/// Deletes a saved key, after asking for confirmation.
|
||||
|
@ -27,10 +27,10 @@ pub struct KeysDeleteCommand {
|
|||
impl AspmSubcommand for KeysDeleteCommand {
|
||||
async fn execute(&self, state: crate::AspmState) -> Result<(), anyhow::Error> {
|
||||
// Fetch key from db
|
||||
let entry = KeysEntity::query_key(&state.db, &self.key)
|
||||
let entry = Keys::query_key(&state.db, &self.key)
|
||||
.await
|
||||
.context("Unable to query keys from database")?;
|
||||
let key: KeysModel = match entry {
|
||||
let key = match entry {
|
||||
KeysQueryResult::None => {
|
||||
eprintln!(
|
||||
"{style}No keys matching the given query were found{reset}",
|
||||
|
|
|
@ -11,7 +11,7 @@ use std::io::Write;
|
|||
|
||||
use crate::{
|
||||
commands::{AspmSubcommand, KeysEntityExt, KeysQueryResult},
|
||||
entities::keys::{Entity as KeysEntity, Model as KeysModel},
|
||||
entities::prelude::*
|
||||
};
|
||||
|
||||
#[derive(ValueEnum, Debug, Clone)]
|
||||
|
@ -39,10 +39,10 @@ pub struct KeysExportCommand {
|
|||
impl AspmSubcommand for KeysExportCommand {
|
||||
async fn execute(&self, state: crate::AspmState) -> Result<(), anyhow::Error> {
|
||||
// Fetch key from db
|
||||
let entry = KeysEntity::query_key(&state.db, &self.key)
|
||||
let entry = Keys::query_key(&state.db, &self.key)
|
||||
.await
|
||||
.context("Unable to query keys from database")?;
|
||||
let key: KeysModel = match entry {
|
||||
let key = match entry {
|
||||
KeysQueryResult::None => {
|
||||
eprintln!(
|
||||
"{style}No keys matching the given query were found{reset}",
|
||||
|
|
|
@ -7,7 +7,7 @@ use sea_orm::EntityTrait;
|
|||
|
||||
use std::io::Write;
|
||||
|
||||
use crate::{commands::AspmSubcommand, entities::keys};
|
||||
use crate::{commands::AspmSubcommand, entities::prelude::*};
|
||||
|
||||
/// A command to list all saved keys, along with their fingerprints and types
|
||||
#[derive(Parser, Debug)]
|
||||
|
@ -16,7 +16,7 @@ pub struct KeysListCommand;
|
|||
#[async_trait::async_trait]
|
||||
impl AspmSubcommand for KeysListCommand {
|
||||
async fn execute(&self, state: crate::AspmState) -> Result<(), anyhow::Error> {
|
||||
let entries = keys::Entity::find()
|
||||
let entries = Keys::find()
|
||||
.all(&state.db)
|
||||
.await
|
||||
.context("Unable to read keys from database")?;
|
||||
|
|
Loading…
Reference in a new issue