1#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
2pub enum Target {
3 Bash,
4 Pwsh,
5}
6#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
7pub enum TargetOs {
8 Linux,
9 Macos,
10 Windows,
11 Freebsd,
12}
13impl TargetOs {
14 pub fn host() -> Self {
15 match std::env::consts::OS {
16 "macos" => Self::Macos,
17 "windows" => Self::Windows,
18 "freebsd" => Self::Freebsd,
19 _ => Self::Linux,
20 }
21 }
22 pub fn is_unix(self) -> bool {
23 self != Self::Windows
24 }
25}
26#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
27pub enum Comments {
28 All,
29 Doc,
30 None,
31}
32#[derive(Debug, Clone)]
33pub struct CompileOptions {
34 pub target: Target,
35 pub os: TargetOs,
36 pub comments: Comments,
37}
38impl Default for CompileOptions {
39 fn default() -> Self {
40 Self {
41 target: Target::Bash,
42 os: TargetOs::host(),
43 comments: Comments::All,
44 }
45 }
46}