Skip to content

Commit

Permalink
Attempting to run pretty 2.0.1 in [babashka](https://github.com/babas…
Browse files Browse the repository at this point in the history
…hka/babashka) yields an error:

```
   (Namespace/find sym)
    ^--- No matching method find found taking 1 args
```

This has been introduced in a [recent
change](clj-commons#95).
Pretty version 2.0 is usable from babashka.

This is because `Namespace/find` is not compiled in babashka (probably considered an implementation detail).
But `clojure.core/find-ns` is included and is equivalent

https://github.com/clojure/clojure/blob/38bafca9e76cd6625d8dce5fb6d16b87845c8b9d/src/clj/clojure/core.clj#L4126-L4130

This change proposes to replace `Namespace/find` with `clojure.core/find-ns`.
  • Loading branch information
nha committed Aug 7, 2023
1 parent d5f62a2 commit 2642e4d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/clj_commons/ansi.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
Reference: [ANSI Escape Codes @ Wikipedia](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR)."
(:require [clojure.string :as str]
[clj-commons.pretty-impl :refer [csi padding]])
(:import (clojure.lang Namespace)))
[clj-commons.pretty-impl :refer [csi padding]]))

(defn- is-ns-loaded?
[sym]
(some? (Namespace/find sym)))
(some? (find-ns sym)))

(defn- to-boolean
[s]
Expand Down Expand Up @@ -311,4 +310,3 @@
(when dirty?
(.append buffer reset-font))
(.toString buffer)))

0 comments on commit 2642e4d

Please sign in to comment.