libxbku_common/
xbku_enums.rs1pub enum XbkuError {
19 HardwareNotSupported,
20 OperatingSystemNotSupported,
21 InvalidSourceList,
22 InvalidSource,
23 InvalidNetworkConnection,
24 InvalidNetworkConfiguration,
25 InvalidArguments,
26 NoError
27}
28
29pub enum XbkuCommand {
30 Help,
31 CheckForXbkuUpdates,
32 CheckForKernelUpdates,
33 CheckForKernelUpdatesAndNotifyCurrentUser,
34 ListOfAvailableMainlineKernels,
35 ListOfInstalledKernels,
36 InstallLatestMainlineKernel,
37 InstallLatestKernelUpdateForPointSeries,
38 InstallSpecificMainlineKernel,
39 RemoveSpecifiedKernel,
40 PurgeOlderDownloads,
41 DownloadPackageForSpecifiedKernel,
42 CleanApplicationCache,
43 Undefined,
44 InvalidCommand
45}
46
47
48impl XbkuCommand {
49 pub fn convert_string_to_enum(input: &str) -> XbkuCommand {
50 return match input{
51 "-h" | "--help" | "--h" => XbkuCommand::Help,
52 "--check-app-updates" | "--check-updates" | "--check-xbku-updates" | "--update-xbku" => XbkuCommand::CheckForXbkuUpdates,
53 "--check-kernel-update" | "--check-kernel" | "--kernel-check" | "-kc" | "--kc" => XbkuCommand::CheckForKernelUpdates,
54 "--check-kernel-updates-notify-current-user" | "--kernel-check-notify" | "--check-kernel-notify" => XbkuCommand::CheckForKernelUpdatesAndNotifyCurrentUser,
55 "--clean-application-cache" | "--clean-app-cache" | "--clean-cache" | "--clear-app-cache" | "--clear-cache" => XbkuCommand::CleanApplicationCache,
56 "--download-package" | "--download" | "--download-specific" => XbkuCommand::DownloadPackageForSpecifiedKernel,
57 "--install-latest-mainline" | "--install-latest-kernel" | "--install-latest" => XbkuCommand::InstallLatestMainlineKernel,
58 "--install-latest-point-update" | "--install-point-update" => XbkuCommand::InstallLatestKernelUpdateForPointSeries,
59 "--install-specific-kernel" | "--install-specific" => XbkuCommand::InstallSpecificMainlineKernel,
60 "--list-available-kernels" | "--list-available" | "--list-available-mainline" | "--list-mainline" => XbkuCommand::ListOfAvailableMainlineKernels,
61 "--list-installed-kernels" => XbkuCommand::ListOfInstalledKernels,
62 "--purge-old-kernels" | "--purge-legacy-kernels" | "--purge-older-kernels" | "--purge-downloads" => XbkuCommand::PurgeOlderDownloads,
63 "--remove" | "--remove-kernel" | "--purge-kernel" => XbkuCommand::RemoveSpecifiedKernel,
64 _=> XbkuCommand::Undefined
65 }
66 }
67}
68
69pub enum XbkuKernelVariants {
70 LowLatency,
71 Generic,
72 GenericLPAE,
73 Snapdragon,
74 Custom,
75 Undefined,
76 InvalidKernelVariant
77}
78
79
80impl XbkuKernelVariants{
81 pub fn convert_string_to_enum(input: &str) -> XbkuKernelVariants {
82
83 return match input {
99 "generic" => XbkuKernelVariants::Generic,
100 "lowlatency" => XbkuKernelVariants::LowLatency,
101 "lpae" => XbkuKernelVariants::GenericLPAE,
102 "qualcomm" | "snapdragon" => XbkuKernelVariants::Snapdragon,
103 _=> XbkuKernelVariants::Undefined
104 }
105 }
106}