Skip to main content

systemprompt_cli/
descriptor.rs

1#[derive(Debug, Clone, Copy, Default)]
2#[allow(clippy::struct_excessive_bools)]
3pub struct CommandDescriptor {
4    pub profile: bool,
5    pub secrets: bool,
6    pub paths: bool,
7    pub database: bool,
8    pub remote_eligible: bool,
9    pub skip_validation: bool,
10}
11
12impl CommandDescriptor {
13    pub const NONE: Self = Self {
14        profile: false,
15        secrets: false,
16        paths: false,
17        database: false,
18        remote_eligible: false,
19        skip_validation: false,
20    };
21
22    pub const PROFILE_ONLY: Self = Self {
23        profile: true,
24        secrets: false,
25        paths: false,
26        database: false,
27        remote_eligible: false,
28        skip_validation: false,
29    };
30
31    pub const PROFILE_AND_SECRETS: Self = Self {
32        profile: true,
33        secrets: true,
34        paths: false,
35        database: false,
36        remote_eligible: false,
37        skip_validation: false,
38    };
39
40    pub const PROFILE_SECRETS_AND_PATHS: Self = Self {
41        profile: true,
42        secrets: true,
43        paths: true,
44        database: false,
45        remote_eligible: false,
46        skip_validation: false,
47    };
48
49    pub const FULL: Self = Self {
50        profile: true,
51        secrets: true,
52        paths: true,
53        database: true,
54        remote_eligible: true,
55        skip_validation: false,
56    };
57
58    pub const fn with_remote_eligible(self) -> Self {
59        Self {
60            profile: self.profile,
61            secrets: self.secrets,
62            paths: self.paths,
63            database: self.database,
64            remote_eligible: true,
65            skip_validation: self.skip_validation,
66        }
67    }
68
69    pub const fn with_skip_validation(self) -> Self {
70        Self {
71            profile: self.profile,
72            secrets: self.secrets,
73            paths: self.paths,
74            database: self.database,
75            remote_eligible: self.remote_eligible,
76            skip_validation: true,
77        }
78    }
79}
80
81pub trait DescribeCommand {
82    fn descriptor(&self) -> CommandDescriptor;
83}