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-R1";
8
9/// The current version as a date string (MMDDYYYY) - for internal tracking
10pub const VERSION_DATE: &str = "04012025";
11
12/// The current version as a human-readable string
13pub const VERSION_STRING: &str = "Pocket v-pocket-R1 (03172025 - Core Implementations)";
14
15/// Compatibility information
16pub const COMPATIBILITY: Option<&str> = Some("");
17
18pub const AUTHOR: &str = "frgmt0 (j)";
19
20/// Get the current version as a structured object
21pub fn get_version() -> Version {
22    Version {
23        letter: VERSION_LETTER,
24        date: VERSION_DATE,
25        semver: env!("CARGO_PKG_VERSION"),
26        name: "Core Implementations",
27        compatibility: COMPATIBILITY,
28        stability: Stability::Beta,
29        author: AUTHOR,
30    }
31}
32
33/// Version stability levels
34pub enum Stability {
35    /// Alpha: Experimental and seeking feedback
36    Alpha,
37    
38    /// Beta: Still buggy but not completely unusable
39    Beta,
40    
41    /// Candidate: Almost ready for official release
42    Candidate,
43    
44    /// Release: Stable and ready for production use
45    Release,
46}
47
48impl std::fmt::Display for Stability {
49    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
50        match self {
51            Stability::Alpha => write!(f, "Alpha"),
52            Stability::Beta => write!(f, "Beta"),
53            Stability::Candidate => write!(f, "Candidate"),
54            Stability::Release => write!(f, "Release"),
55        }
56    }
57}
58
59/// Version information structure
60pub struct Version {
61    /// Version in letter-based format (e.g., v-pocket-R1)
62    pub letter: &'static str,
63    
64    /// Version as a date string (MMDDYYYY) - for internal tracking
65    pub date: &'static str,
66    
67    /// SemVer version from Cargo.toml (required for Rust ecosystem)
68    pub semver: &'static str,
69    
70    /// Name of this version/release
71    pub name: &'static str,
72    
73    /// Compatibility information (None means fully compatible)
74    pub compatibility: Option<&'static str>,
75    
76    /// Stability level
77    pub stability: Stability,
78
79    /// Author of this version/release
80    pub author: &'static str,
81}
82
83impl std::fmt::Display for Version {
84    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
85        write!(f, "Built by {}\n\n", self.author)?;
86        write!(f, "{}", self.letter)?;
87        
88        if let Some(compat) = self.compatibility {
89            write!(f, " - {}", compat)?;
90        }
91        
92        write!(f, " ({})", self.name)?;
93        
94        Ok(())
95    }
96}