-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added capabilities file #158
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Peter Macdonald <macdonald.peter90@gmail.com>
Good evening! And sorry for not getting back to you before... hectic weekend 👩👩👧👦 😅 |
Yeah I can do that! Let me see if I can make something a bit more tidy, was a bit hack and slash to put it together 😂 |
No worries! If it's too messy we'll work on it together :) |
Awesome to have you here, helping out @Parsifal-M 😃! |
Signed-off-by: Peter Macdonald <macdonald.peter90@gmail.com>
Hey! 👋 So I did a bit more hacking this weekend while I was sick, appologies if there is some funky stuff in there, I had a bit of brain fog 😆 Also, not sure what the The script does not work yet I get this error:
Not sure if it's something to do with how the data looks like in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Left some comments, but this is a good first attempt.
About the .lsp abd .clj-kondo directories, I think they're added by the VS Code plugin. Those directories only make sense in the core
subdirectory, so should probably be added to gitignore here. You can delete them from the PR.
core/src/main/cljc/jarl/gencaps.cljc
Outdated
@@ -0,0 +1,20 @@ | |||
(ns jarl.gencaps | |||
(:require [jarl.builtins.registry :as registry] | |||
[clojure.core :as core] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required implicitly, and does not need to be here 🙂
core/src/main/cljc/jarl/gencaps.cljc
Outdated
|
||
;; Import capabilities.json as a Clojure data structure | ||
(def capabilities (-> "capabilities.json" | ||
core/slurp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, you don't need to state "core" anywhere
core/src/main/cljc/jarl/gencaps.cljc
Outdated
(def capabilities (-> "capabilities.json" | ||
core/slurp | ||
(core/str) | ||
core/read-string)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error you're seeing is from this line — the read-string
function is for Clojure data, not JSON. You can require jarl.encoding.json :as json
and then use json/read-str
here instead 🙂
core/src/main/cljc/jarl/gencaps.cljc
Outdated
(def supported (set (keys registry/builtins))) | ||
|
||
;; Import capabilities.json as a Clojure data structure | ||
(def capabilities (-> "capabilities.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the use of the threading macro! 😃
core/src/main/cljc/jarl/gencaps.cljc
Outdated
capabilities)) | ||
|
||
;; Write the matching JSON objects to a new file called gencaps.json | ||
(core/spit "gencaps.json" (pr-str matching-capabilities)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, you probably want to use json/write-str
here
Nice! Will work on these thanks for reviewing so far 👍 |
…ignore to ignore the kondo and lsp stuff Signed-off-by: Peter Macdonald <macdonald.peter90@gmail.com>
Signed-off-by: Peter Macdonald <macdonald.peter90@gmail.com>
Hey 👋 Still working on this, currently, the output is an empty |
Hey @anderseknert! 👋
Added the capabilities file 😄
Thank you for letting me work on this 👍
Signed-off-by: Peter Macdonald macdonald.peter90@gmail.com