summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCyborus <cyborus@noreply.codeberg.org>2024-12-12 20:36:07 +0100
committerCyborus <cyborus@noreply.codeberg.org>2024-12-12 20:36:07 +0100
commit9db33e37e4c709a345a0b3154879f5ba1f790d4b (patch)
tree05dd371182d1fc65210d2f6ae9c25ddfb5b2c1bc /src
parentMerge pull request 'bump version in `flake.nix` to 0.2.0' (#148) from bump-fl... (diff)
parentfeat: add --verbose flag to version command (diff)
downloadforgejo-cli-9db33e37e4c709a345a0b3154879f5ba1f790d4b.tar.xz
forgejo-cli-9db33e37e4c709a345a0b3154879f5ba1f790d4b.zip
Merge pull request 'add `version --verbose`' (#149) from verbose-version into main
Reviewed-on: https://codeberg.org/Cyborus/forgejo-cli/pulls/149
Diffstat (limited to 'src')
-rw-r--r--src/version.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/version.rs b/src/version.rs
index 70cae8d..f3ab776 100644
--- a/src/version.rs
+++ b/src/version.rs
@@ -8,11 +8,23 @@ pub struct VersionCommand {
#[clap(long)]
#[cfg(feature = "update-check")]
check: bool,
+ #[clap(short, long)]
+ verbose: bool,
}
+const BUILD_TYPE: &str = match option_env!("BUILD_TYPE") {
+ Some(s) => s,
+ None => "from source",
+};
+
impl VersionCommand {
pub async fn run(self) -> eyre::Result<()> {
- println!("{}", env!("CARGO_PKG_VERSION"));
+ println!("{} v{}", env!("CARGO_BIN_NAME"), env!("CARGO_PKG_VERSION"));
+ if self.verbose {
+ println!("user agent: {}", crate::keys::USER_AGENT);
+ println!("build type: {BUILD_TYPE}");
+ println!(" target: {}", env!("BUILD_TARGET"));
+ }
#[cfg(feature = "update-check")]
self.update_msg().await?;
Ok(())