Added capabilities file - #158
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 |
anderseknert
left a comment
There was a problem hiding this comment.
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.
| @@ -0,0 +1,20 @@ | |||
| (ns jarl.gencaps | |||
| (:require [jarl.builtins.registry :as registry] | |||
| [clojure.core :as core] | |||
There was a problem hiding this comment.
This is required implicitly, and does not need to be here 🙂
|
|
||
| ;; Import capabilities.json as a Clojure data structure | ||
| (def capabilities (-> "capabilities.json" | ||
| core/slurp |
There was a problem hiding this comment.
Similarly, you don't need to state "core" anywhere
| (def capabilities (-> "capabilities.json" | ||
| core/slurp | ||
| (core/str) | ||
| core/read-string)) |
There was a problem hiding this comment.
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 🙂
| (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.
Love the use of the threading macro! 😃
| capabilities)) | ||
|
|
||
| ;; Write the matching JSON objects to a new file called gencaps.json | ||
| (core/spit "gencaps.json" (pr-str matching-capabilities)) No newline at end of file |
There was a problem hiding this comment.
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