mirror of https://github.com/Hilbis/Hilbish
website: add subpages to doc navigation and description
parent
dff65d6d03
commit
05570ec29a
|
@ -2,6 +2,7 @@
|
||||||
title: Introduction
|
title: Introduction
|
||||||
layout: doc
|
layout: doc
|
||||||
weight: -1
|
weight: -1
|
||||||
|
menu: docs
|
||||||
---
|
---
|
||||||
|
|
||||||
Here lies the documentation for Hilbish, the hyper extensible Lua shell.
|
Here lies the documentation for Hilbish, the hyper extensible Lua shell.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
title: Frequently Asked Questions
|
title: Frequently Asked Questions
|
||||||
layout: doc
|
layout: doc
|
||||||
weight: -20
|
weight: -20
|
||||||
|
menu: docs
|
||||||
---
|
---
|
||||||
|
|
||||||
# Is Hilbish POSIX compliant?
|
# Is Hilbish POSIX compliant?
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
title: Features
|
||||||
|
layout: doc
|
||||||
|
weight: -40
|
||||||
|
menu: docs
|
||||||
|
---
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
---
|
||||||
|
title: Runner Mode
|
||||||
|
description: Customize the interactive script/command runner.
|
||||||
|
layout: doc
|
||||||
|
menu:
|
||||||
|
docs:
|
||||||
|
parent: "Features"
|
||||||
|
---
|
||||||
|
|
||||||
|
Hilbish is *unique,* when interactive it first attempts to run input as
|
||||||
|
Lua and then tries shell script. But if you're normal, you wouldn't
|
||||||
|
really be using Hilbish anyway but you'd also not want this
|
||||||
|
(or maybe want Lua only in some cases.)
|
||||||
|
|
||||||
|
The "runner mode" of Hilbish is customizable via `hilbish.runnerMode`,
|
||||||
|
which determines how Hilbish will run user input. By default, this is
|
||||||
|
set to `hybrid` which is the previously mentioned behaviour of running Lua
|
||||||
|
first then going to shell script. If you want the reverse order, you can
|
||||||
|
set it to `hybridRev` and for isolated modes there is `sh` and `lua`
|
||||||
|
respectively.
|
||||||
|
|
||||||
|
You can also set it to a function, which will be called everytime Hilbish
|
||||||
|
needs to run interactive input. For example, you can set this to a simple
|
||||||
|
function to compile and evaluate Fennel, and now you can run Fennel.
|
||||||
|
You can even mix it with sh to make a hybrid mode with Lua replaced by
|
||||||
|
Fennel.
|
||||||
|
|
||||||
|
An example:
|
||||||
|
```lua
|
||||||
|
hilbish.runnerMode(function(input)
|
||||||
|
local ok = pcall(fennel.eval, input)
|
||||||
|
if ok then
|
||||||
|
return input, 0, nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return hilbish.runner.sh(input)
|
||||||
|
end)
|
||||||
|
```
|
||||||
|
|
||||||
|
The `hilbish.runner` interface is an alternative to using `hilbish.runnerMode`
|
||||||
|
and also provides the sh and Lua runner functions that Hilbish itself uses.
|
||||||
|
A runner function is expected to return 3 values: the input, exit code, and an error.
|
||||||
|
The input return is there incase you need to prompt for more input.
|
||||||
|
If you don't, just return the input passed to the runner function.
|
||||||
|
The exit code has to be a number, it will be 0 otherwise and the error can be
|
||||||
|
`nil` to indicate no error.
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
These are the "low level" functions for the `hilbish.runner` interface.
|
||||||
|
|
||||||
|
+ setMode(mode) > The same as `hilbish.runnerMode`
|
||||||
|
+ sh(input) -> input, code, err > Runs `input` in Hilbish's sh interpreter
|
||||||
|
+ lua(input) -> input, code, err > Evals `input` as Lua code
|
||||||
|
|
||||||
|
The others here are defined in Lua and have EmmyLua documentation.
|
||||||
|
These functions should be preferred over the previous ones.
|
||||||
|
+ setCurrent(mode) > The same as `setMode`, but works with runners managed
|
||||||
|
via the functions below.
|
||||||
|
+ add(name, runner) > Adds a runner to a table of available runners. The `runner`
|
||||||
|
argument is either a function or a table with a run callback.
|
||||||
|
+ set(name, runner) > The same as `add` but requires passing a table and
|
||||||
|
overwrites if the `name`d runner already exists.
|
||||||
|
+ get(name) > runner > Gets a runner by name. It is a table with at least a
|
||||||
|
run function, to run input.
|
||||||
|
+ exec(cmd, runnerName) > Runs `cmd` with a runner. If `runnerName` isn't passed,
|
||||||
|
the current runner mode is used.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
title: Getting Started
|
title: Getting Started
|
||||||
layout: doc
|
layout: doc
|
||||||
weight: -10
|
weight: -10
|
||||||
|
menu: docs
|
||||||
---
|
---
|
||||||
|
|
||||||
To start Hilbish, open a terminal. If Hilbish has been installed and is not the
|
To start Hilbish, open a terminal. If Hilbish has been installed and is not the
|
||||||
|
|
|
@ -4,12 +4,23 @@
|
||||||
<div class="p-3 col">
|
<div class="p-3 col">
|
||||||
<ul class="nav nav-pills mb-auto">
|
<ul class="nav nav-pills mb-auto">
|
||||||
{{ $currentPage := . }}
|
{{ $currentPage := . }}
|
||||||
{{ range where site.Pages.ByWeight.Reverse "Type" "docs" }}
|
{{ range .Site.Menus.docs.ByWeight.Reverse }}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{ .Permalink }}" class="nav-link">
|
<a href="{{ .URL }}" class="nav-link">
|
||||||
{{ .Title }}
|
{{ .Title }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{{ if .Children }}
|
||||||
|
<ul>
|
||||||
|
{{ range .Children }}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{ .URL }}" class="nav-link">
|
||||||
|
{{ .Title }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,6 +28,9 @@
|
||||||
<div class="col" style="max-width: 80em; margin: auto;">
|
<div class="col" style="max-width: 80em; margin: auto;">
|
||||||
<div>
|
<div>
|
||||||
<h1>{{ .Title }}</h1>
|
<h1>{{ .Title }}</h1>
|
||||||
|
{{ if .Description }}
|
||||||
|
<p><i>{{ .Description }}</i></p>
|
||||||
|
{{ end}}
|
||||||
{{.Content}}
|
{{.Content}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue