Fix formatting issues.
This commit is contained in:
1 parent
70dec5834e
commit
d6999153ae
15 files changed
+30
-28
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
disable_all_formatting = true
|
||||||
+2
-2
@@ -1,13 +1,13 @@
|
|||||||
use super::Exit;
|
use super::Exit;
|
||||||
|
|
||||||
/// A subcommand that keel can run.
|
/// A subcommand that keel can run.
|
||||||
pub trait Command
|
pub trait Command
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit>;
|
fn run(&self) -> anyhow::Result<Exit>;
|
||||||
|
|
||||||
/// The exit status used when `run` returns an error.
|
/// The exit status used when `run` returns an error.
|
||||||
///
|
///
|
||||||
/// Hook subcommands return `Exit::Ok` here, so an
|
/// Hook subcommands return `Exit::Ok` here, so an
|
||||||
/// internal error never aborts a pacman transaction.
|
/// internal error never aborts a pacman transaction.
|
||||||
fn on_error(&self) -> Exit { Exit::Error }
|
fn on_error(&self) -> Exit { Exit::Error }
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ use crate::cli::{ Exit, Command };
|
|||||||
#[derive(Debug, Args)]
|
#[derive(Debug, Args)]
|
||||||
pub struct Ack;
|
pub struct Ack;
|
||||||
|
|
||||||
impl Command for Ack {
|
impl Command for Ack
|
||||||
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel ack") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel ack") }
|
||||||
}
|
}
|
||||||
@@ -14,9 +14,9 @@ pub enum CacheAction {
|
|||||||
Prune(Prune),
|
Prune(Prune),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CacheAction
|
impl CacheAction
|
||||||
{
|
{
|
||||||
pub fn command(&self) -> &dyn Command
|
pub fn command(&self) -> &dyn Command
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
Self::Prune(c) => c,
|
Self::Prune(c) => c,
|
||||||
@@ -24,7 +24,7 @@ impl CacheAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Command for Cache
|
impl Command for Cache
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { self.action.command().run() }
|
fn run(&self) -> anyhow::Result<Exit> { self.action.command().run() }
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ impl Command for Cache
|
|||||||
#[derive(Debug, Args)]
|
#[derive(Debug, Args)]
|
||||||
pub struct Prune;
|
pub struct Prune;
|
||||||
|
|
||||||
impl Command for Prune
|
impl Command for Prune
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel cache prune") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel cache prune") }
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ pub struct Check {
|
|||||||
pub download: bool,
|
pub download: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Command for Check
|
impl Command for Check
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel check") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel check") }
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,13 @@ use crate::cli::{ Exit, Command };
|
|||||||
/// Show the package changes between a snapshot and the live root.
|
/// Show the package changes between a snapshot and the live root.
|
||||||
#[derive(Debug, Args)]
|
#[derive(Debug, Args)]
|
||||||
pub struct Diff {
|
pub struct Diff {
|
||||||
/// The snapshot to compare with, as the snapshot provider names it.
|
/// The snapshot to compare with, as the snapshot provider names it.
|
||||||
/// The default is the rollback target.
|
/// The default is the rollback target.
|
||||||
#[arg(value_name = "SNAPSHOT")]
|
#[arg(value_name = "SNAPSHOT")]
|
||||||
pub snapshot: Option<String>,
|
pub snapshot: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Command for Diff
|
impl Command for Diff
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel diff") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel diff") }
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ use crate::cli::{ Exit, Command };
|
|||||||
#[derive(Debug, Args)]
|
#[derive(Debug, Args)]
|
||||||
pub struct Doctor;
|
pub struct Doctor;
|
||||||
|
|
||||||
impl Command for Doctor
|
impl Command for Doctor
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel doctor") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel doctor") }
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ use crate::cli::{ Exit, Command };
|
|||||||
#[derive(Debug, Args)]
|
#[derive(Debug, Args)]
|
||||||
pub struct Gc;
|
pub struct Gc;
|
||||||
|
|
||||||
impl Command for Gc
|
impl Command for Gc
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel gc") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel gc") }
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ use crate::cli::{ Exit, Command };
|
|||||||
#[derive(Debug, Args)]
|
#[derive(Debug, Args)]
|
||||||
pub struct Index;
|
pub struct Index;
|
||||||
|
|
||||||
impl Command for Index
|
impl Command for Index
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel index") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel index") }
|
||||||
}
|
}
|
||||||
@@ -13,15 +13,15 @@ mod toggle;
|
|||||||
mod verify;
|
mod verify;
|
||||||
|
|
||||||
pub use ack::Ack;
|
pub use ack::Ack;
|
||||||
pub use cache::{Cache, CacheAction, Prune};
|
pub use cache::{ Cache, Prune, CacheAction };
|
||||||
pub use check::Check;
|
pub use check::Check;
|
||||||
pub use diff::Diff;
|
pub use diff::Diff;
|
||||||
pub use doctor::Doctor;
|
pub use doctor::Doctor;
|
||||||
pub use gc::Gc;
|
pub use gc::Gc;
|
||||||
pub use hook::{Hook, Phase, Post, Pre, Removals};
|
pub use hook::{ Pre, Hook, Post, Phase, Removals };
|
||||||
pub use index::Index;
|
pub use index::Index;
|
||||||
pub use notify::Notify;
|
pub use notify::Notify;
|
||||||
pub use rollback::Rollback;
|
pub use rollback::Rollback;
|
||||||
pub use status::Status;
|
pub use status::Status;
|
||||||
pub use toggle::{Disable, Enable, HookSet};
|
pub use toggle::{ Enable, Disable, HookSet };
|
||||||
pub use verify::Verify;
|
pub use verify::Verify;
|
||||||
@@ -6,7 +6,7 @@ use crate::cli::{ Exit, Command };
|
|||||||
#[derive(Debug, Args)]
|
#[derive(Debug, Args)]
|
||||||
pub struct Notify;
|
pub struct Notify;
|
||||||
|
|
||||||
impl Command for Notify
|
impl Command for Notify
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel notify") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel notify") }
|
||||||
}
|
}
|
||||||
@@ -5,8 +5,8 @@ use crate::cli::{ Exit, Command };
|
|||||||
/// Replace the root subvolume with a writable copy of a snapshot.
|
/// Replace the root subvolume with a writable copy of a snapshot.
|
||||||
#[derive(Debug, Args)]
|
#[derive(Debug, Args)]
|
||||||
pub struct Rollback {
|
pub struct Rollback {
|
||||||
/// The snapshot to restore, as the snapshot provider names it. The default is the rollback
|
/// The snapshot to restore, as the snapshot provider names it.
|
||||||
/// target.
|
/// The default is the rollback target.
|
||||||
#[arg(value_name = "SNAPSHOT", conflicts_with = "promote")]
|
#[arg(value_name = "SNAPSHOT", conflicts_with = "promote")]
|
||||||
pub snapshot: Option<String>,
|
pub snapshot: Option<String>,
|
||||||
|
|
||||||
@@ -22,13 +22,13 @@ pub struct Rollback {
|
|||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
pub reboot: bool,
|
pub reboot: bool,
|
||||||
|
|
||||||
/// Wait until pacman releases its database lock, then roll back without asking. The post
|
/// Wait until pacman releases its database lock, then roll back without asking.
|
||||||
/// hook starts this in a transient unit after the user has already confirmed.
|
/// The post hook starts this in a transient unit after the user has already confirmed.
|
||||||
#[arg(long, hide = true, requires = "snapshot")]
|
#[arg(long, hide = true, requires = "snapshot")]
|
||||||
pub deferred: bool,
|
pub deferred: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Command for Rollback
|
impl Command for Rollback
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel rollback") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel rollback") }
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ use crate::cli::{ Exit, Command };
|
|||||||
#[derive(Debug, Args)]
|
#[derive(Debug, Args)]
|
||||||
pub struct Status;
|
pub struct Status;
|
||||||
|
|
||||||
impl Command for Status
|
impl Command for Status
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel status") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel status") }
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ pub struct Enable {
|
|||||||
pub hooks: HookSet,
|
pub hooks: HookSet,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Command for Enable
|
impl Command for Enable
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel enable") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel enable") }
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ pub struct Disable {
|
|||||||
pub hooks: HookSet,
|
pub hooks: HookSet,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Command for Disable
|
impl Command for Disable
|
||||||
{
|
{
|
||||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel disable") }
|
fn run(&self) -> anyhow::Result<Exit> { todo!("keel disable") }
|
||||||
}
|
}
|
||||||
+3
-3
@@ -4,15 +4,15 @@ use std::process::ExitCode;
|
|||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum Exit {
|
pub enum Exit {
|
||||||
Ok = 0,
|
Ok = 0,
|
||||||
/// Blocking findings, or a refused rollback.
|
/// Blocking findings, or a refused rollback.
|
||||||
/// The pre hook's wrapper aborts pacman on
|
/// The pre hook's wrapper aborts pacman on
|
||||||
/// this status and on no other.
|
/// this status and on no other.
|
||||||
Blocked = 1,
|
Blocked = 1,
|
||||||
/// A usage or environment error.
|
/// A usage or environment error.
|
||||||
Error = 2,
|
Error = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Exit> for ExitCode
|
impl From<Exit> for ExitCode
|
||||||
{
|
{
|
||||||
fn from(exit: Exit) -> Self { ExitCode::from(exit as u8) }
|
fn from(exit: Exit) -> Self { ExitCode::from(exit as u8) }
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user