diff options
| author | 2024-09-01 19:42:43 -0500 | |
|---|---|---|
| committer | 2024-09-01 19:42:43 -0500 | |
| commit | 567ce637bd459b80aec8619a228016b35fe56c6b (patch) | |
| tree | 389f19ffad05d482ac725e70f0299ea9eb2e82fe /doc | |
| parent | Remove redundant H1s (diff) | |
Add a Usage section to main index.mdz
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/index.mdz | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/doc/index.mdz b/doc/index.mdz index b4bfd57..d35372c 100644 --- a/doc/index.mdz +++ b/doc/index.mdz @@ -18,7 +18,26 @@ think of spork as a sort of extended standard library for Janet. ## Install @codeblock``` -[sudo] jpm install spork +$ [sudo] jpm install spork ``` +## Usage + +Every binding in the spork library will be imported if you @code`(import spork)` in either a Janet source file or at a Janet REPL: + +@codeblock``` +Janet 1.35.2-fda0a081 linux/x64/gcc - '(doc)' for help +repl:1:> (import spork) +@{_ @{:value <cycle 0>} spork/argparse/argparse @{:private true} spork/base64/decode @{:private true} spork/base64/encode @{:private true} spork/crc/make-variant @{:private true} spork/crc/named-variant @{:private true} spork/cron/check @{:private true} spork/cron/next-timestamp @{:private true} spork/cron/parse-cron @{:private true} ...} +repl:2:> +``` + +However, it's usually more practical to only import the specific module you want using @code`(import spork/[module])`, replacing @code`[module]` as appropriate. For example: + +@codeblock``` +Janet 1.35.2-fda0a081 linux/x64/gcc - '(doc)' for help +repl:1:> (import spork/netrepl) +@{_ @{:value <cycle 0>} netrepl/client @{:private true} netrepl/default-host @{:private true} netrepl/default-port @{:private true} netrepl/server @{:private true} netrepl/server-single @{:private true}} +repl:2:> +``` |
