Closed teodorlu closed 5 months ago
Please answer the following questions and leave the below in as part of your PR.
[x] This PR corresponds to an issue with a clear problem statement.
[x] I have updated the CHANGELOG.md file with a description of the addressed issue.
This PR addresses #215. Currently, neil add kaocha may add the :kaocha alias with one fewer indent than expected, leaving a deps.edn file like this:
neil add kaocha
:kaocha
deps.edn
{:paths ["src"] :deps {babashka/fs {:mvn/version "0.2.16"} babashka/process {:mvn/version "0.4.16"} borkdude/edamame {:mvn/version "1.4.25"} cheshire/cheshire {:mvn/version "5.11.0"} enlive/enlive {:mvn/version "1.1.6"} org.babashka/cli {:mvn/version "0.6.44"} org.clj-commons/hickory {:mvn/version "0.7.3"} org.clojure/data.xml {:mvn/version "0.0.8"}} :aliases {:dev {:extra-paths ["dev" "test"] :extra-deps {io.github.nextjournal/clerk {:mvn/version "0.13.842"}}} :kaocha ;; added by neil {:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}} :main-opts ["-m" "kaocha.runner"]}}}
The :dev and :kaocha aliases don't line up.
:dev
add-alias
add-alias-str
borkdude.rewrite-edn/assoc-in
I've tried to write the tests so that it's easy to see visually how indents line up.
If we merge this PR, we may consider storing kaocha-alias and nrepl-alias as clojure data. Currently, they are strings:
kaocha-alias
nrepl-alias
https://github.com/teodorlu/neil/blob/02c0fc9c68db2e9f0cd876605eb1aca6ab7a013f/src/babashka/neil.clj#L205-L209
https://github.com/teodorlu/neil/blob/02c0fc9c68db2e9f0cd876605eb1aca6ab7a013f/src/babashka/neil.clj#L225-L229
Thanks!
Please answer the following questions and leave the below in as part of your PR.
[x] This PR corresponds to an issue with a clear problem statement.
[x] I have updated the CHANGELOG.md file with a description of the addressed issue.
Problem
This PR addresses #215. Currently,
neil add kaocha
may add the:kaocha
alias with one fewer indent than expected, leaving adeps.edn
file like this:The
:dev
and:kaocha
aliases don't line up.Proposed solution
add-alias
into a pure part (add-alias-str
) and an impure part (add-alias
)add-alias-str
using onlyborkdude.rewrite-edn/assoc-in
, avoid manually calculating indent spacesTests
I've tried to write the tests so that it's easy to see visually how indents line up.
Future work
If we merge this PR, we may consider storing
kaocha-alias
andnrepl-alias
as clojure data. Currently, they are strings:https://github.com/teodorlu/neil/blob/02c0fc9c68db2e9f0cd876605eb1aca6ab7a013f/src/babashka/neil.clj#L205-L209
https://github.com/teodorlu/neil/blob/02c0fc9c68db2e9f0cd876605eb1aca6ab7a013f/src/babashka/neil.clj#L225-L229