diff --git a/CHANGES.md b/CHANGES.md index 30c3f88..df9d662 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ ## unreleased +### Added + +- Add the `--version` command-line option (#13, @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} ]