Browse Source

Initial commit

master 0.1.0
sloum 2 months ago
commit
a8c1f942c3
  1. 17
      README.md
  2. 22
      main.slo
  3. 10
      module.json

17
README.md

@ -0,0 +1,17 @@
# modules
Support utilities for working with [slope](https://git.rawtext.club/slope-lang/slope) modules.
## Usage
Currently this module only exposes a single function, `mod-exists?`, which allows callers to identify whether or not a given module is available.
``` slope
(load-mod "modules")
;; (mod-exists? [module-name: string]) => bool
(mod-exists? "csv" "flag") ; => #t
```
`mod-exists?` can take any number of module names as strings. It will only return true if all of the given modules are available.

22
main.slo

@ -0,0 +1,22 @@
;;;
;;; modules - Module management utilities
;;; Author: sloum
;;; Version: 0.1.0
;;;
;; Takes any number of strings and verifies if the
;; given modules are available to the current runtime
(define mod-exists? (lambda (...)
(equal? 0
(length
(filter
(lambda (b) (equal? #f b))
(map
(lambda (v)
(or
(path-exists? (path-join (mod-path) v))
(path-exists? (path-join "/usr/local/lib/slope/modules" v))))
...))))))
(define _USAGE [
["mod-exists?" "(mod-exists? [module-name: string...]) => bool\n\nChecks if the given module is installed on the system and available to the current runtime. `#t` will only be returned if all of the given modules are present (it functions like `and`)"]])

10
module.json

@ -0,0 +1,10 @@
{
"title": "modules",
"description": "Module management utilities",
"author": "sloum",
"version": "0.1.0",
"homepage": "",
"repository": "https://git.rawtext.club/sloum/modules",
"tag": "0.1.0",
"dependencies": []
}
Loading…
Cancel
Save