@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Special color for unavailable items
|
- Special color for unavailable items
|
||||||
- Changelog with all the relevant user-facing changes to the project
|
- Changelog with all the relevant user-facing changes to the project
|
||||||
- `info` command line subcommand to show platform specific information
|
- `info` command line subcommand to show platform specific information
|
||||||
|
- Append Git commit hash to version string
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
19
build.rs
Normal file
19
build.rs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
use std::process::Command;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut version = String::from(env!("CARGO_PKG_VERSION"));
|
||||||
|
if let Some(commit_hash) = commit_hash() {
|
||||||
|
version = format!("{version} ({commit_hash})");
|
||||||
|
}
|
||||||
|
println!("cargo:rustc-env=VERSION={version}");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn commit_hash() -> Option<String> {
|
||||||
|
Command::new("git")
|
||||||
|
.args(["rev-parse", "--short", "HEAD"])
|
||||||
|
.output()
|
||||||
|
.ok()
|
||||||
|
.filter(|output| output.status.success())
|
||||||
|
.and_then(|output| String::from_utf8(output.stdout).ok())
|
||||||
|
.map(|hash| hash.trim().into())
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ pub fn program_arguments() -> clap::Command {
|
|||||||
};
|
};
|
||||||
|
|
||||||
clap::Command::new("ncspot")
|
clap::Command::new("ncspot")
|
||||||
.version(env!("CARGO_PKG_VERSION"))
|
.version(env!("VERSION"))
|
||||||
.author(AUTHOR)
|
.author(AUTHOR)
|
||||||
.about("cross-platform ncurses Spotify client")
|
.about("cross-platform ncurses Spotify client")
|
||||||
.after_help(backends)
|
.after_help(backends)
|
||||||
|
|||||||
Reference in New Issue
Block a user