From 369b55a9feb848a58b3e5e7a469fa642b0b31949 Mon Sep 17 00:00:00 2001 From: Guillaume Petiot Date: Fri, 8 Mar 2024 16:01:20 +0000 Subject: [PATCH 1/2] Add the '--version' command-line option --- CHANGES.md | 4 ++++ bin/dune | 2 +- bin/main.ml | 7 ++++++- dune-project | 1 + get-activity.opam | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 30c3f88..8d1cdaf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ ## unreleased +### Added + +- Add the `--version` command-line option (#, @gpetiot) + ### Changed - Replace exceptions by result types for the requests (#11, @gpetiot) diff --git a/bin/dune b/bin/dune index 6f08743..7f8fa6e 100644 --- a/bin/dune +++ b/bin/dune @@ -2,4 +2,4 @@ (name main) (public_name get-activity) (package get-activity) - (libraries cmdliner get-activity-lib)) + (libraries cmdliner dune-build-info get-activity-lib)) diff --git a/bin/main.ml b/bin/main.ml index d352a42..a3fa828 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -68,7 +68,12 @@ let period = in Term.(const f $ from $ to_ $ last_week) -let info = Cmd.info "get-activity" +let version = + match Build_info.V1.version () with + | None -> "dev" + | Some v -> Build_info.V1.Version.to_string v + +let info = Cmd.info "get-activity" ~version let run period : unit = match mode with diff --git a/dune-project b/dune-project index b6c77b2..33fdacd 100644 --- a/dune-project +++ b/dune-project @@ -10,6 +10,7 @@ (synopsis "Collect activity as markdown") (depends (cmdliner (>= 1.1.1)) + dune-build-info (get-activity-lib (= :version)))) (package diff --git a/get-activity.opam b/get-activity.opam index 5e831b5..45496bd 100644 --- a/get-activity.opam +++ b/get-activity.opam @@ -8,6 +8,7 @@ bug-reports: "https://github.com/tarides/get-activity/issues" depends: [ "dune" {>= "2.8"} "cmdliner" {>= "1.1.1"} + "dune-build-info" "get-activity-lib" {= version} "odoc" {with-doc} ] From 8f9669b02be06a03f3538d123a175837ea18098f Mon Sep 17 00:00:00 2001 From: "Guillaume \"Liam\" Petiot" Date: Fri, 8 Mar 2024 16:16:45 +0000 Subject: [PATCH 2/2] Update CHANGES.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 8d1cdaf..df9d662 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,7 +2,7 @@ ### Added -- Add the `--version` command-line option (#, @gpetiot) +- Add the `--version` command-line option (#13, @gpetiot) ### Changed