aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/src/lib.rs7
-rw-r--r--cli/src/stats.rs6
2 files changed, 9 insertions, 4 deletions
diff --git a/cli/src/lib.rs b/cli/src/lib.rs
index ba7f792..937ae99 100644
--- a/cli/src/lib.rs
+++ b/cli/src/lib.rs
@@ -35,7 +35,7 @@ mod stats;
pub struct Cli {
pub version: String,
- pub master_hash: String,
+ pub master_hash: Option<String>,
}
pub fn main(cli: Cli) {
@@ -44,7 +44,10 @@ pub fn main(cli: Cli) {
info!("Compiled with FUSEs")
}
- let version = format!("{} ({})", cli.version, cli.master_hash);
+ let version = match cli.master_hash {
+ Some(ref h) => format!("{} ({})", cli.version, h),
+ None => cli.version.clone(),
+ };
let args = App::new("ilc")
.version(&version[..])
.setting(AppSettings::GlobalVersion)
diff --git a/cli/src/stats.rs b/cli/src/stats.rs
index 390a200..8c92cc6 100644
--- a/cli/src/stats.rs
+++ b/cli/src/stats.rs
@@ -13,7 +13,7 @@ use error;
struct StatFormat {
version: String,
- master_hash: String,
+ master_hash: Option<String>,
time: String,
stats: Stats,
}
@@ -28,7 +28,9 @@ impl Serialize for StatFormat {
where S: Serializer
{
try!(s.serialize_struct_elt("version", &self.0.version));
- try!(s.serialize_struct_elt("master_hash", &self.0.master_hash));
+ if let &Some(ref h) = &self.0.master_hash {
+ try!(s.serialize_struct_elt("master_hash", h));
+ }
try!(s.serialize_struct_elt("time", &self.0.time));
try!(s.serialize_struct_elt("stats", &self.0.stats));
Ok(None)