feat(readarr): fetch Readarr disk space and expose it on the CLI
Add ReadarrEvent::GetDiskSpace, mapped to GET /diskspace, and get_readarr_diskspace, which stores the result on ReadarrData for the root folder and system views. Surface it as `managarr readarr list disk-space`, matching the other three servarrs. Readarr returns a label field on some records that DiskSpace does not model; serde drops it, so the CLI prints only the path and the free and total space, as it does for the other three servarrs.
This commit is contained in:
7 files changed
+242
-2
No files matched your search
@@ -3,12 +3,14 @@ use std::sync::Arc;
|
||||
use anyhow::Result;
|
||||
use clap::Subcommand;
|
||||
use get_command_handler::{ReadarrGetCommand, ReadarrGetCommandHandler};
|
||||
use list_command_handler::{ReadarrListCommand, ReadarrListCommandHandler};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use super::{CliCommandHandler, Command};
|
||||
use crate::{app::App, network::NetworkTrait};
|
||||
|
||||
mod get_command_handler;
|
||||
mod list_command_handler;
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "readarr_command_tests.rs"]
|
||||
@@ -21,6 +23,11 @@ pub enum ReadarrCommand {
|
||||
about = "Commands to fetch details of the resources in your Readarr instance"
|
||||
)]
|
||||
Get(ReadarrGetCommand),
|
||||
#[command(
|
||||
subcommand,
|
||||
about = "Commands to list attributes from your Readarr instance"
|
||||
)]
|
||||
List(ReadarrListCommand),
|
||||
}
|
||||
|
||||
impl From<ReadarrCommand> for Command {
|
||||
@@ -55,6 +62,11 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, ReadarrCommand> for ReadarrCliHandler<'a,
|
||||
.handle()
|
||||
.await?
|
||||
}
|
||||
ReadarrCommand::List(list_command) => {
|
||||
ReadarrListCommandHandler::with(self.app, list_command, self.network)
|
||||
.handle()
|
||||
.await?
|
||||
}
|
||||
};
|
||||
|
||||
Ok(result)
|
||||
|
||||
Reference in new issue
Block a user