pocket_cli/
version.rs

1/// Version information for Pocket
2/// 
3/// This module provides version information in both SemVer (for Cargo)
4/// and our letter-based versioning system that prioritizes communication
5
6/// The current version in letter-based format
7pub const VERSION_LETTER: &str = "v-pocket-R3B1-ncR2<";
8
9/// The current version as a date string (MMDDYYYY) - for internal tracking
10pub const VERSION_DATE: &str = "03252025";
11
12/// The current version as a human-readable string
13pub const VERSION_STRING: &str = "Pocket v-pocket-R3B1-ncR2< (03252025 - Plugin System)";
14
15/// Compatibility information
16pub const COMPATIBILITY: Option<&str> = Some("Compatibility only extends to basic functions of Pocket and does not include any VCS support or Plugin support");
17
18/// Get the current version as a letter-based string
19pub fn get_version_letter() -> &'static str {
20    VERSION_LETTER
21}
22
23/// Get the current version as a date string (for internal tracking)
24pub fn get_version_date() -> &'static str {
25    VERSION_DATE
26}
27
28/// Get the current version as a human-readable string
29pub fn get_version_string() -> &'static str {
30    VERSION_STRING
31}
32
33/// Get the current version as a structured object
34pub fn get_version() -> Version {
35    Version {
36        letter: VERSION_LETTER,
37        date: VERSION_DATE,
38        semver: env!("CARGO_PKG_VERSION"),
39        name: "Plugin System",
40        compatibility: COMPATIBILITY,
41        stability: Stability::Beta,
42    }
43}
44
45/// Version stability levels
46pub enum Stability {
47    /// Alpha: Experimental and seeking feedback
48    Alpha,
49    
50    /// Beta: Still buggy but not completely unusable
51    Beta,
52    
53    /// Candidate: Almost ready for official release
54    Candidate,
55    
56    /// Release: Stable and ready for production use
57    Release,
58}
59
60impl std::fmt::Display for Stability {
61    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
62        match self {
63            Stability::Alpha => write!(f, "Alpha"),
64            Stability::Beta => write!(f, "Beta"),
65            Stability::Candidate => write!(f, "Candidate"),
66            Stability::Release => write!(f, "Release"),
67        }
68    }
69}
70
71/// Version information structure
72pub struct Version {
73    /// Version in letter-based format (e.g., v-pocket-R1)
74    pub letter: &'static str,
75    
76    /// Version as a date string (MMDDYYYY) - for internal tracking
77    pub date: &'static str,
78    
79    /// SemVer version from Cargo.toml (required for Rust ecosystem)
80    pub semver: &'static str,
81    
82    /// Name of this version/release
83    pub name: &'static str,
84    
85    /// Compatibility information (None means fully compatible)
86    pub compatibility: Option<&'static str>,
87    
88    /// Stability level
89    pub stability: Stability,
90}
91
92impl std::fmt::Display for Version {
93    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
94        write!(f, "{}", self.letter)?;
95        
96        if let Some(compat) = self.compatibility {
97            write!(f, "-{}", compat)?;
98        }
99        
100        write!(f, " ({})", self.name)
101    }
102}