Skip to content

Commit

Permalink
API.md
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Feb 29, 2024
1 parent 1a32ed3 commit c8a5d8c
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Function.
Convenience macro around [`process`](#babashka.process/process). Takes command as varargs. Options can
be passed via metadata on the form or as a first map arg. Supports
interpolation via `~`
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L521-L551">Source</a></sub></p>
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L537-L567">Source</a></sub></p>

## <a name="babashka.process/*defaults*">`*defaults*`</a><a name="babashka.process/*defaults*"></a>

Expand All @@ -47,7 +47,7 @@ Convenience macro around [`process`](#babashka.process/process). Takes command a

Dynamic var containing overridable default options. Use
`alter-var-root` to change permanently or `binding` to change temporarily.
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L200-L205">Source</a></sub></p>
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L202-L207">Source</a></sub></p>

## <a name="babashka.process/alive?">`alive?`</a><a name="babashka.process/alive?"></a>
``` clojure
Expand All @@ -56,7 +56,7 @@ Dynamic var containing overridable default options. Use
```

Returns `true` if the process is still running and false otherwise.
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L646-L649">Source</a></sub></p>
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L664-L667">Source</a></sub></p>

## <a name="babashka.process/check">`check`</a><a name="babashka.process/check"></a>
``` clojure
Expand Down Expand Up @@ -95,8 +95,12 @@ Same as [[`destroy`](#babashka.process/destroy)](#babashka.process/destroy) but

Replaces the current process image with the process image specified
by the given path invoked with the given args. Works only in GraalVM
native images. Override the first argument using `:arg0`.
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L576-L612">Source</a></sub></p>
native images (which includes babashka).

Supported `opts`
- `:arg0`: override first argument (the executable). No-op on Windows.
- `:cmd`, `:env`,`:extra-env`, `:escape`,`:pre-start-fn` : see [`process`](#babashka.process/process).
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L592-L630">Source</a></sub></p>

## <a name="babashka.process/parse-args">`parse-args`</a><a name="babashka.process/parse-args"></a>
``` clojure
Expand All @@ -113,7 +117,7 @@ Parses arguments to [`process`](#babashka.process/process) to map with:
Note that this function bridges the legacy `[cmds ?opts]` syntax to
the newer recommended syntax `[?opts & args]` and therefore looks
unnecessarily complex.
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L266-L315">Source</a></sub></p>
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L271-L320">Source</a></sub></p>

## <a name="babashka.process/pb">`pb`</a><a name="babashka.process/pb"></a>
``` clojure
Expand All @@ -122,7 +126,7 @@ Parses arguments to [`process`](#babashka.process/process) to map with:
```

Returns a process builder (as record).
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L317-L324">Source</a></sub></p>
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L322-L329">Source</a></sub></p>

## <a name="babashka.process/pipeline">`pipeline`</a><a name="babashka.process/pipeline"></a>
``` clojure
Expand All @@ -140,7 +144,7 @@ Returns the processes for one pipe created with -> or creates

Also see [Pipelines](/README.md#pipelines).

<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L466-L500">Source</a></sub></p>
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L482-L516">Source</a></sub></p>

## <a name="babashka.process/process">`process`</a><a name="babashka.process/process"></a>
``` clojure
Expand Down Expand Up @@ -176,8 +180,8 @@ Creates a child process. Takes a command (vector of strings or
For redirecting to Clojure's `*in*`, `*out*` or `*err*` stream, set
the corresponding option accordingly.
The `:out` and `:err` options support `:string` for writing to a string
output. You will need to `deref` the process before accessing the string
via the process's `:out`.
output and `:bytes` for writing to a byte array. You will need to `deref`
the process before accessing the string or byte array via the process's `:out`.
To redirect `:err` to `:out`, specify `:err :out`.
For writing output to a file, you can set `:out` and `:err` to a `java.io.File` object, or a keyword:
- `:write` + an additional `:out-file`/`:err-file` + file to write to the file.
Expand All @@ -197,7 +201,7 @@ Creates a child process. Takes a command (vector of strings or
map. Typically used with [`destroy`](#babashka.process/destroy) or [`destroy-tree`](#babashka.process/destroy-tree) to ensure long
running processes are cleaned up on shutdown.
- `:exit-fn`: a function which is executed upon exit. Receives process map as argument. Only supported in JDK11+.
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L397-L449">Source</a></sub></p>
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L413-L465">Source</a></sub></p>

## <a name="babashka.process/process*">`process*`</a><a name="babashka.process/process*"></a>
``` clojure
Expand All @@ -206,7 +210,7 @@ Creates a child process. Takes a command (vector of strings or
```

Same as with [`process`](#babashka.process/process) but called with parsed arguments (the result from [`parse-args`](#babashka.process/parse-args))
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L334-L395">Source</a></sub></p>
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L341-L411">Source</a></sub></p>

## <a name="babashka.process/sh">`sh`</a><a name="babashka.process/sh"></a>
``` clojure
Expand All @@ -218,7 +222,7 @@ Convenience function similar to `clojure.java.shell/sh` that sets
`:out` and `:err` to `:string` by default and blocks. Similar to
`cjs/sh` it does not check the exit code (this can be done with
[`check`](#babashka.process/check)).
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L553-L563">Source</a></sub></p>
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L569-L579">Source</a></sub></p>

## <a name="babashka.process/shell">`shell`</a><a name="babashka.process/shell"></a>
``` clojure
Expand All @@ -242,7 +246,7 @@ Convenience function around [`process`](#babashka.process/process) that was orig
- `(shell {:out "/tmp/log.txt"} "git commit -m" "WIP")` ;; `"git commit -m"` is tokenized as `["git" "commit" "-m"]` and `"WIP"` is an additional argument

Also see the [`shell`](#babashka.process/shell) entry in the babashka book [here](https://book.babashka.org/#_shell).
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L620-L644">Source</a></sub></p>
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L638-L662">Source</a></sub></p>

## <a name="babashka.process/start">`start`</a><a name="babashka.process/start"></a>
``` clojure
Expand All @@ -251,7 +255,7 @@ Convenience function around [`process`](#babashka.process/process) that was orig
```

Takes a process builder, calls start and returns a process (as record).
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L502-L508">Source</a></sub></p>
<p><sub><a href="https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L518-L524">Source</a></sub></p>

## <a name="babashka.process/tokenize">`tokenize`</a><a name="babashka.process/tokenize"></a>
``` clojure
Expand Down

0 comments on commit c8a5d8c

Please sign in to comment.