systemprompt_cli/commands/infrastructure/jobs/
mod.rs1pub mod types;
2
3mod cleanup_logs;
4mod cleanup_sessions;
5mod disable;
6mod enable;
7mod helpers;
8mod history;
9mod list;
10mod run;
11mod show;
12
13use anyhow::Result;
14use clap::Subcommand;
15
16use crate::cli_settings::CliConfig;
17use crate::shared::render_result;
18
19use systemprompt_generator as _;
20
21#[derive(Debug, Subcommand)]
22pub enum JobsCommands {
23 #[command(about = "List available jobs")]
24 List,
25
26 #[command(about = "Show detailed information about a job")]
27 Show(show::ShowArgs),
28
29 #[command(about = "Run a scheduled job manually")]
30 Run(run::RunArgs),
31
32 #[command(about = "View job execution history")]
33 History(history::HistoryArgs),
34
35 #[command(about = "Enable a job")]
36 Enable(enable::EnableArgs),
37
38 #[command(about = "Disable a job")]
39 Disable(disable::DisableArgs),
40
41 #[command(about = "Clean up inactive sessions")]
42 CleanupSessions(cleanup_sessions::CleanupSessionsArgs),
43
44 #[command(about = "Clean up old log entries")]
45 LogCleanup(cleanup_logs::LogCleanupArgs),
46
47 #[command(about = "Clean up inactive sessions (alias)", hide = true)]
48 SessionCleanup(cleanup_sessions::CleanupSessionsArgs),
49}
50
51pub async fn execute(cmd: JobsCommands, _config: &CliConfig) -> Result<()> {
52 match cmd {
53 JobsCommands::List => {
54 render_result(&list::execute());
55 Ok(())
56 },
57 JobsCommands::Show(args) => {
58 render_result(&show::execute(args).await?);
59 Ok(())
60 },
61 JobsCommands::Run(args) => {
62 render_result(&run::execute(args).await?);
63 Ok(())
64 },
65 JobsCommands::History(args) => {
66 render_result(&history::execute(args).await?);
67 Ok(())
68 },
69 JobsCommands::Enable(args) => {
70 render_result(&enable::execute(args).await?);
71 Ok(())
72 },
73 JobsCommands::Disable(args) => {
74 render_result(&disable::execute(args).await?);
75 Ok(())
76 },
77 JobsCommands::CleanupSessions(args) | JobsCommands::SessionCleanup(args) => {
78 render_result(&cleanup_sessions::execute(args).await?);
79 Ok(())
80 },
81 JobsCommands::LogCleanup(args) => {
82 render_result(&cleanup_logs::execute(args).await?);
83 Ok(())
84 },
85 }
86}