Skip to content

Commit

Permalink
Add some jpm declare- docs (janet-lang#34, janet-lang#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
sogaiu committed Feb 3, 2024
1 parent 905080a commit 692957e
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions content/docs/jpm.mdz
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,12 @@ the entry point to your executable.
# This will be printed when you run `jpm build`
(print "build time!")

(defn main [& args]
# You can also get command-line arguments through (dyn :args)
(print "args: " ;(interpose ", " args))
(mylib1/do-thing)
(mylib2/do-thing))
(defn main
[& args]
# You can also get command-line arguments through (dyn :args)
(print "args: " ;(interpose ", " args))
(mylib1/do-thing)
(mylib2/do-thing))
```

It's important to remember that code at the top level will run when you invoke
Expand Down Expand Up @@ -282,6 +283,36 @@ at runtime, though.
For an example Janet executable built with @code`jpm`, see
@link[https://github.com/bakpakin/littleserver][https://github.com/bakpakin/littleserver].

### Other @code`declare-` callables

Some additional @code`declare-` callables are:

@ul{@li{@code`declare-bin`

@p{Declare a generic file to be installed as an
executable. Specify file path via @code`:main`.}}

@li{@code`declare-binscript`

@p{Declare a janet file to be installed as an executable
script. Creates a shim on windows. If
@code`:hardcode-syspath` is true, will insert code into the
script such that it will run correctly even when
@code`JANET_PATH` is changed. If @code`:is-janet` is
truthy, will also automatically insert a correct shebang
line if jpm's configuration is set with
@code`:auto-shebang` as truthy.}}

@li{@code`declare-headers`

@p{Declare headers for a library installation. Installed
headers can be used by other native libraries. Specify
paths via @code`:headers` and prefix via @code`:prefix`.}}

@li{@code`declare-manpage`

@p{Mark a manpage for installation.}}}

## Custom Trees

For per-project or per-user development (as opposed to system-wide development), you can use
Expand Down

0 comments on commit 692957e

Please sign in to comment.