Files
sydnix/scripts/sydnix-cli/src/sydnix_cli/main.clj
2025-01-14 21:44:21 -07:00

26 lines
877 B
Clojure
Executable File

(ns sydnix-cli.main
(:require
[babashka.cli :as cli]
[sydnix-cli.cli-table :refer [*cli-table]]
[sydnix-cli.commands.help :as cmd-help :refer [adorn-with-help-option*]]
[sydnix-cli.commands.rebuild :as cmd-rebuild]
[sydnix-cli.commands.status :as cmd-status]
[sydnix-cli.commands.util :as cmd-util])
(:gen-class))
(def real-cli-table
(map adorn-with-help-option*
(concat cmd-status/commands
cmd-rebuild/commands
cmd-util/commands
[cmd-help/command
;; Show help when no other command matches.
(assoc cmd-help/command :cmds [])])))
(defn -main [& args]
(reset! *cli-table real-cli-table)
(cli/dispatch @*cli-table args)
;; Process may hang without this form. D:{
;; https://github.com/babashka/process?tab=readme-ov-file#script-termination
(shutdown-agents))