Skip to main content

cup_cli/config/
program.rs

1use std::path::{Path, PathBuf};
2
3use crate::config::Shelling;
4
5#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
6pub struct ProgramConfig {
7    pub name: String,
8    pub src: PathBuf,
9}
10
11impl<P: AsRef<Path>> Shelling<Program, P> for ProgramConfig {
12    fn shelling(self, base: P) -> Program {
13        Program {
14            name: self.name,
15            src: if self.src.is_relative() {
16                base.as_ref().join(self.src)
17            } else {
18                self.src
19            },
20        }
21    }
22}
23
24#[derive(Debug, Clone)]
25pub struct Program {
26    pub name: String,
27    pub src: PathBuf,
28}