|
18 | 18 | */ |
19 | 19 |
|
20 | 20 | use crossterm::style::Stylize; |
21 | | -use sysinfo::{System, SystemExt}; |
22 | 21 |
|
23 | | -use crate::{option::Config, utils::capitalize_ascii}; |
| 22 | +use crate::option::Config; |
24 | 23 |
|
25 | 24 | pub fn print(config: &Config) { |
26 | 25 | let scheme = config.parseable.get_scheme(); |
27 | 26 | status_info(config, &scheme); |
28 | | - version::print(); |
29 | 27 | storage_info(config); |
30 | | - system_info(); |
| 28 | + version::print(); |
31 | 29 | println!(); |
32 | 30 | } |
33 | 31 |
|
@@ -57,31 +55,16 @@ fn storage_info(config: &Config) { |
57 | 55 | eprintln!( |
58 | 56 | " |
59 | 57 | {} |
60 | | - Local Staging Path: {} |
61 | | - {} Storage: {}", |
| 58 | + Mode: {} |
| 59 | + Staging path: {} |
| 60 | + Store path: {}", |
62 | 61 | "Storage:".to_string().blue().bold(), |
| 62 | + config.storage_name, |
63 | 63 | config.staging_dir().to_string_lossy(), |
64 | | - capitalize_ascii(config.storage_name), |
65 | 64 | config.storage().get_endpoint(), |
66 | 65 | ) |
67 | 66 | } |
68 | 67 |
|
69 | | -pub fn system_info() { |
70 | | - let system = System::new_all(); |
71 | | - eprintln!( |
72 | | - " |
73 | | - {} |
74 | | - OS: {} |
75 | | - Processor: {} logical, {} physical |
76 | | - Memory: {:.2} GiB total", |
77 | | - "System:".to_string().blue().bold(), |
78 | | - os_info::get(), |
79 | | - num_cpus::get(), |
80 | | - num_cpus::get_physical(), |
81 | | - system.total_memory() as f32 / (1024 * 1024 * 1024) as f32 |
82 | | - ) |
83 | | -} |
84 | | - |
85 | 68 | pub fn warning_line() { |
86 | 69 | eprint!( |
87 | 70 | " |
@@ -112,24 +95,34 @@ pub mod version { |
112 | 95 | } |
113 | 96 | } |
114 | 97 |
|
| 98 | + pub fn print_version(current_version: semver::Version, commit_hash: String) { |
| 99 | + eprint!( |
| 100 | + " |
| 101 | + {} |
| 102 | + Version: {} |
| 103 | + Commit hash: {} |
| 104 | + GitHub: https://github.com/parseablehq/parseable |
| 105 | + Docs: https://www.parseable.io/docs/introduction", |
| 106 | + "About:".to_string().blue().bold(), |
| 107 | + current_version, |
| 108 | + commit_hash |
| 109 | + ); |
| 110 | + } |
| 111 | + |
115 | 112 | pub fn print() { |
116 | 113 | // print current version |
117 | 114 | let current = current(); |
118 | 115 |
|
119 | 116 | match current.0 { |
120 | 117 | ParseableVersion::Version(current_version) => { |
121 | | - // not eprintln because if it is old release then time passed with be displayed beside it |
122 | | - eprint!( |
123 | | - " |
124 | | - {} {} ", |
125 | | - "Current Version:".to_string().blue().bold(), |
126 | | - current_version |
127 | | - ); |
128 | | - |
129 | | - // check for latest release |
130 | | - let Ok(latest_release) = update::get_latest() else { |
131 | | - eprintln!(); |
132 | | - return |
| 118 | + print_version(current_version.clone(), current.1); |
| 119 | + // check for latest release, if it cannot be fetched then print error as warn and return |
| 120 | + let latest_release = match update::get_latest() { |
| 121 | + Ok(latest_release) => latest_release, |
| 122 | + Err(e) => { |
| 123 | + log::warn!("{}", e); |
| 124 | + return; |
| 125 | + } |
133 | 126 | }; |
134 | 127 |
|
135 | 128 | if latest_release.version > current_version { |
|
0 commit comments