refactor: Rename sydnix → sydnix-cli

This commit is contained in:
Madeleine Sydney
2025-01-14 20:24:07 -07:00
parent 29fd94f9e2
commit 0e9bad81ee
20 changed files with 55 additions and 57 deletions

View File

@@ -18,4 +18,4 @@
:main-opts ["-m" "nrepl.cmdline"
"--socket" ".nrepl/socket"]}
:run
{:main-opts ["-m" "sydnix.main"]}}}
{:main-opts ["-m" "sydnix-cli.main"]}}}

View File

@@ -18,38 +18,32 @@
];
};
sydnix = pkgs.mkCljBin {
name = "msyds/sydnix";
main-ns = "sydnix.main";
projectSrc = ./.;
sydnix-cli-unwrapped = clj-nix.lib.mkCljApp {
pkgs = nixpkgs.legacyPackages.${system};
modules = [
{
name = "msyds/sydnix-cli";
version = "1.0";
main-ns = "sydnix-cli.main";
projectSrc = ./.;
buildInputs = with pkgs; [
asciidoctor
nativeImage = {
enable = true;
};
# customJdk.enable = true;
}
];
nativeBuildInputs = with pkgs; [
makeWrapper
];
postInstall = ''
wrapProgram $out/bin/sydnix \
--set ADOC_PROCESSOR "${pkgs.asciidoctor}/bin/asciidoctor"
'';
};
in {
packages.default = clj-nix.lib.mkCljApp {
pkgs = nixpkgs.legacyPackages.${system};
modules = [
{
name = "msyds/sydnix";
version = "1.0";
main-ns = "sydnix.main";
projectSrc = ./.;
nativeImage = {
enable = true;
};
# customJdk.enable = true;
}
];
packages.default = pkgs.symlinkJoin {
name = "sydnix-cli";
version = "0.0.0";
paths = [ sydnix-cli-unwrapped ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postInstall = ''
wrapProgram $out/bin/sydnix \
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.asciidoctor ]}
'';
};
devShells.default = pkgs.mkShell {

View File

@@ -1,3 +1,3 @@
(ns sydnix.cli-table)
(ns sydnix-cli.cli-table)
(def *cli-table (atom nil))

View File

@@ -1,8 +1,7 @@
(ns sydnix.commands.help
(ns sydnix-cli.commands.help
(:require
[babashka.process :as p]
[sydnix.mangen :as mangen]))
[sydnix-cli.mangen :as mangen]))
(defn adorn-with-help-option [wrapped-command-fn]
(fn [{:keys [opts dispatch]}]
@@ -26,7 +25,10 @@
(defn- wrap-command-fn [wrapped-fn]
(fn [info]
(if (:help (:opts info))
(view-man-for-command (mangen/find-dispatched (:dispatch info)))
(do (mangen/render-docs-for-command
(mangen/find-dispatched (:dispatch info)))
#_
(view-man-for-command (mangen/find-dispatched (:dispatch info))))
(when-not (nil? wrapped-fn)
(wrapped-fn info)))))

View File

@@ -1,7 +1,7 @@
(ns sydnix.commands.rebuild
(ns sydnix-cli.commands.rebuild
(:require
[clojure.java.shell :refer [sh]]
[sydnix.commands.help :refer [adorn-with-help-option*]]))
[sydnix-cli.commands.help :refer [adorn-with-help-option*]]))
(def command-options-spec
{:flake {:coerce :string

View File

@@ -1,6 +1,6 @@
(ns sydnix.commands.status
(ns sydnix-cli.commands.status
(:require
[sydnix.commands.help :refer [adorn-with-help-option*]]))
[sydnix-cli.commands.help :refer [adorn-with-help-option*]]))
(defn- command-fn [opts]
(prn opts))

View File

@@ -1,6 +1,6 @@
(ns sydnix.commands.util
(ns sydnix-cli.commands.util
(:require
[sydnix.commands.util.mangen :as cmd-util-mangen]))
[sydnix-cli.commands.util.mangen :as cmd-util-mangen]))
(def commands
[{:cmds ["util"]

View File

@@ -1,15 +1,15 @@
(ns sydnix.commands.util.mangen
(ns sydnix-cli.commands.util.mangen
(:require
[asciidoc.render]
[babashka.fs :as fs]
[babashka.process :as p]
[sydnix.mangen :as mangen]
[clojure.java.io :as io]
[clojure.spec.alpha :as s]
[clojure.string :as str]
[sydnix.cli-table :refer [*cli-table]]
[sydnix.commands.help :refer [adorn-with-help-option*]]
[sydnix.prelude :as prelude]))
[sydnix-cli.mangen :as mangen]
[sydnix-cli.cli-table :refer [*cli-table]]
[sydnix-cli.commands.help :refer [adorn-with-help-option*]]
[sydnix-cli.prelude :as prelude]))
(defn command-fn [{:keys [yes output-directory]}]
(if (or yes

View File

@@ -1,11 +1,11 @@
(ns sydnix.main
(ns sydnix-cli.main
(:require
[babashka.cli :as cli]
[sydnix.cli-table :refer [*cli-table]]
[sydnix.commands.help :as cmd-help :refer [adorn-with-help-option*]]
[sydnix.commands.rebuild :as cmd-rebuild]
[sydnix.commands.status :as cmd-status]
[sydnix.commands.util :as cmd-util])
[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

View File

@@ -1,4 +1,4 @@
(ns sydnix.mangen
(ns sydnix-cli.mangen
(:require
[asciidoc.render]
[asciidoc.types]
@@ -6,7 +6,7 @@
[babashka.process :as p]
[clojure.spec.alpha :as s]
[clojure.string :as str]
[sydnix.cli-table :refer [*cli-table]])
[sydnix-cli.cli-table :refer [*cli-table]])
(:import
[java.io BufferedReader PipedReader PipedWriter]))

View File

@@ -1,4 +1,4 @@
(ns sydnix.prelude
(ns sydnix-cli.prelude
(:require
[clojure.core.match :refer [match]]))