You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
872 B
64 lines
872 B
use super::*;
|
|
use std::{
|
|
str,
|
|
fmt,
|
|
};
|
|
|
|
|
|
/// Target for oneshots
|
|
#[derive(Debug)]
|
|
pub enum Target
|
|
{
|
|
/// Fired when daemon starts
|
|
Startup,
|
|
/// Fired when config reloaded
|
|
Reload,
|
|
/// Fired only when user tells it to
|
|
Specific,
|
|
}
|
|
|
|
/// When the job should be ran
|
|
#[derive(Debug)]
|
|
pub enum When
|
|
{
|
|
/// Run when a target is reached
|
|
Oneshot(Target),
|
|
/// Run on an interval
|
|
Interval(interval::Time),
|
|
}
|
|
|
|
/// A command for `Job`
|
|
#[derive(Debug)]
|
|
pub struct Command
|
|
{
|
|
program: String,
|
|
args: Vec<String>,
|
|
}
|
|
|
|
/// Output for `define-job`
|
|
#[derive(Debug)]
|
|
pub struct Job
|
|
{
|
|
name: String,
|
|
when: Vec<When>,
|
|
what: Command,
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
pub enum Error {
|
|
|
|
}
|
|
impl std::error::Error for Error{}
|
|
impl std::fmt::Display for Error
|
|
{
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
|
|
{
|
|
todo!()
|
|
}
|
|
}
|
|
|
|
|
|
|