Fork me on GitHub
#babashka
<
2024-03-15
>
James Bence02:03:36

Curious on the error message produced by running this:

James Bence02:03:44

#!/usr/bin/env bb
#

(require '[babashka.cli :as cli])

(cli/parse-opts ["--port" "1339"] {:coerce {:port :long}})

1
James Bence02:03:05

----- Error --------------------------------------------------------------------
Type:     java.lang.ClassCastException
Message:  clojure.lang.PersistentList cannot be cast to clojure.lang.Named

James Bence03:03:56

This is the first example at https://github.com/babashka/cli?tab=readme-ov-file#options I am using (excerpt from bb print-deps)

{:deps
 {babashka/babashka.core
  {:git/url "",
   :git/sha "52a6037bd4b632bffffb04394fb4efd0cdab6b1e"},
  org.babashka/cli {:mvn/version "0.8.57"},
installed with brew (borkdude/brew/babashka 1.3.189), and the JDK is openjdk version "21.0.1" 2023-10-17 Where is the list that cannot be cast in those two lines?

Bob B03:03:37

I think it's the hash on line 2

Bob B03:03:33

since # isn't a comment in clojure, I think what's happening is that bb is reading the file starting with the hash, and I think it's trying to read the require as a tagged element

James Bence03:03:48

That's exactly what it is. Thank you!

👍 1