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