diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9f4324f..1655e5a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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' diff --git a/src/k16/kl/cli.clj b/src/k16/kl/cli.clj index 4834906..7494471 100644 --- a/src/k16/kl/cli.clj +++ b/src/k16/kl/cli.clj @@ -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 diff --git a/src/k16/kl/commands/containers.clj b/src/k16/kl/commands/containers.clj index ba36f1c..f9b6fe5 100644 --- a/src/k16/kl/commands/containers.clj +++ b/src/k16/kl/commands/containers.clj @@ -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]