Skip to content

Commit

Permalink
Add version metadata to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
julienvincent committed Oct 29, 2023
1 parent 70faed8 commit 801ffe1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Checkout git repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Fetch Tags
run: git fetch --tags origin

- uses: actions/setup-java@v2
with:
distribution: 'temurin'
Expand Down
18 changes: 15 additions & 3 deletions src/k16/kl/cli.clj
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
(ns k16.kl.cli
(:require
[babashka.process :as proc]
[cli-matic.core :refer [run-cmd]]
[clojure.string :as str]
[k16.kl.commands.containers :as cmd.containers]
[k16.kl.commands.endpoints :as cmd.endpoints]
[k16.kl.commands.modules :as cmd.modules]
[k16.kl.commands.network :as cmd.network]
[k16.kl.commands.resolver :as cmd.resolver]
[k16.kl.commands.routes :as cmd.routes]
[k16.kl.commands.services :as cmd.services])
[k16.kl.commands.services :as cmd.services]
[k16.kl.log :as log])
(:gen-class))

(set! *warn-on-reflection* true)

(defmacro version []
(let [res (proc/sh (str/split "git describe --abbrev=0 --tags" #" "))]
(str/replace (str/trim (:out res)) #"v" "")))

(def cli-configuration
{:command "kl"
:description "A CLI for running remotely defined services"
:version "0.0.0"
:subcommands [cmd.modules/cmd
:version (version)
:subcommands [{:command "version"
:description "Print the current CLI version"
:runs (fn [_]
(log/info (version)))}

cmd.modules/cmd
cmd.network/cmd
cmd.resolver/cmd
cmd.containers/cmd
Expand Down
1 change: 0 additions & 1 deletion src/k16/kl/commands/containers.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(:require
[clojure.pprint :as pprint]
[k16.kl.api.executor :as api.executor]
[k16.kl.api.fs :as api.fs]
[k16.kl.api.module :as api.module]
[k16.kl.api.proxy :as api.proxy]
[k16.kl.api.resolver :as api.resolver]
Expand Down

0 comments on commit 801ffe1

Please sign in to comment.