1use clap::ValueEnum;
2use serde::{Deserialize, Serialize};
3use strum::Display;
4
5pub mod generator;
6pub mod settings;
7pub mod wizard;
8
9pub type Result<T> = std::result::Result<T, Error>;
10
11pub const PIPI_VERSION: &str = "0.1.1";
13
14#[derive(thiserror::Error, Debug)]
15pub enum Error {
16 #[error("{0}")]
17 Message(String),
18
19 #[error(transparent)]
20 Dialog(#[from] dialoguer::Error),
21
22 #[error(transparent)]
23 IO(#[from] std::io::Error),
24
25 #[error(transparent)]
26 FS(#[from] fs_extra::error::Error),
27
28 #[error(transparent)]
29 TemplateEngine(#[from] Box<rhai::EvalAltResult>),
30
31 #[error(transparent)]
32 Generator(#[from] crate::generator::executer::Error),
33}
34impl Error {
35 pub fn msg<S: Into<String>>(msg: S) -> Self {
36 Self::Message(msg.into())
37 }
38}
39
40#[derive(Debug, Clone, Deserialize, Serialize, Display, Default, PartialEq, Eq, ValueEnum)]
41pub enum OS {
42 #[cfg_attr(windows, default)]
43 #[serde(rename = "windows")]
44 Windows,
45
46 #[cfg_attr(unix, default)]
47 #[serde(rename = "linux")]
48 Linux,
49
50 #[serde(rename = "macos")]
51 Macos,
52}