mirror of
https://github.com/Hilbis/Hilbish
synced 2025-07-06 11:02:03 +00:00
Compare commits
8 Commits
da5a1d0e34
...
fa92729288
Author | SHA1 | Date | |
---|---|---|---|
fa92729288 | |||
de238ecfea | |||
793a043c7b | |||
6a41388699 | |||
2a2bf03fad | |||
279ea433e2 | |||
1cbfc35c70 | |||
4b28efe639 |
@ -403,7 +403,7 @@ func main() {
|
|||||||
shortDesc := piece.Doc[0]
|
shortDesc := piece.Doc[0]
|
||||||
desc := piece.Doc[1:]
|
desc := piece.Doc[1:]
|
||||||
interfaceModules[modname].ShortDescription = shortDesc
|
interfaceModules[modname].ShortDescription = shortDesc
|
||||||
interfaceModules[modname].Description = strings.Join(desc, "\n")
|
interfaceModules[modname].Description = strings.Replace(strings.Join(desc, "\n"), "<nl>", "\\\n \\", -1)
|
||||||
interfaceModules[modname].Fields = piece.Fields
|
interfaceModules[modname].Fields = piece.Fields
|
||||||
interfaceModules[modname].Properties = piece.Properties
|
interfaceModules[modname].Properties = piece.Properties
|
||||||
continue
|
continue
|
||||||
@ -441,7 +441,7 @@ func main() {
|
|||||||
Types: filteredTypePieces,
|
Types: filteredTypePieces,
|
||||||
Docs: filteredPieces,
|
Docs: filteredPieces,
|
||||||
ShortDescription: shortDesc,
|
ShortDescription: shortDesc,
|
||||||
Description: strings.Join(desc, "\n"),
|
Description: strings.Replace(strings.Join(desc, "\n"), "<nl>", "\\\n \\", -1),
|
||||||
HasInterfaces: hasInterfaces,
|
HasInterfaces: hasInterfaces,
|
||||||
Properties: docPieceTag("property", tags),
|
Properties: docPieceTag("property", tags),
|
||||||
Fields: docPieceTag("field", tags),
|
Fields: docPieceTag("field", tags),
|
||||||
@ -627,6 +627,7 @@ func generateFile(v module) {
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
`, htmlSig, dps.FuncName))
|
`, htmlSig, dps.FuncName))
|
||||||
f.WriteString("```\n\n")
|
f.WriteString("```\n\n")
|
||||||
@ -723,7 +724,7 @@ func table(elems [][]string) string {
|
|||||||
for _, line := range elems {
|
for _, line := range elems {
|
||||||
b.WriteString("<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>\n")
|
b.WriteString("<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>\n")
|
||||||
for _, col := range line {
|
for _, col := range line {
|
||||||
b.WriteString("<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>")
|
b.WriteString("<td class='p-3 font-medium text-black dark:text-white'>")
|
||||||
b.WriteString(col)
|
b.WriteString(col)
|
||||||
b.WriteString("</td>\n")
|
b.WriteString("</td>\n")
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "bait",
|
"name": "bait",
|
||||||
"shortDescription": "the event emitter",
|
"shortDescription": "the event emitter",
|
||||||
"description": "\nBait is the event emitter for Hilbish. Much like Node.js and\nits `events` system, many actions in Hilbish emit events.\nUnlike Node.js, Hilbish events are global. So make sure to\npick a unique name!\n\nUsage of the Bait module consists of userstanding\nevent-driven architecture, but it's pretty simple:\nIf you want to act on a certain event, you can `catch` it.\nYou can act on events via callback functions.\n\nExamples of this are in the Hilbish default config!\nConsider this part of it:\n```lua\nbait.catch('command.exit', function(code)\n\trunning = false\n\tdoPrompt(code ~= 0)\n\tdoNotifyPrompt()\nend)\n```\n\nWhat this does is, whenever the `command.exit` event is thrown,\nthis function will set the user prompt.",
|
"description": "\nBait is the event emitter for Hilbish. Much like Node.js and\nits `events` system, many actions in Hilbish emit events.\nUnlike Node.js, Hilbish events are global. So make sure to\npick a unique name!\\\n \\\nUsage of the Bait module consists of userstanding\nevent-driven architecture, but it's pretty simple:\nIf you want to act on a certain event, you can `catch` it.\nYou can act on events via callback functions.\\\n \\\nExamples of this are in the Hilbish default config!\nConsider this part of it:\n\n```lua\nbait.catch('command.exit', function(code)\n\trunning = false\n\tdoPrompt(code ~= 0)\n\tdoNotifyPrompt()\nend)\n```\n\nWhat this does is, whenever the `command.exit` event is thrown,\nthis function will set the user prompt.",
|
||||||
"properties": [],
|
"properties": [],
|
||||||
"fields": [],
|
"fields": [],
|
||||||
"docs": [
|
"docs": [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "commander",
|
"name": "commander",
|
||||||
"shortDescription": "library for custom commands",
|
"shortDescription": "library for custom commands",
|
||||||
"description": "\nCommander is the library which handles Hilbish commands. This makes\nthe user able to add Lua-written commands to their shell without making\na separate script in a bin folder. Instead, you may simply use the Commander\nlibrary in your Hilbish config.\n\n```lua\nlocal commander = require 'commander'\n\ncommander.register('hello', function(args, sinks)\n\tsinks.out:writeln 'Hello world!'\nend)\n```\n\nIn this example, a command with the name of `hello` is created\nthat will print `Hello world!` to output. One question you may\nhave is: What is the `sinks` parameter?\n\nThe `sinks` parameter is a table with 3 keys: `input`, `out`, and `err`.\nThere is an `in` alias to `input`, but it requires using the string accessor syntax (`sinks['in']`)\nas `in` is also a Lua keyword, so `input` is preferred for use.\nAll of them are a @Sink.\nIn the future, `sinks.in` will be removed.\n\n- `in` is the standard input.\nYou may use the read functions on this sink to get input from the user.\n- `out` is standard output.\nThis is usually where command output should go.\n- `err` is standard error.\nThis sink is for writing errors, as the name would suggest.",
|
"description": "\nCommander is the library which handles Hilbish commands. This makes\nthe user able to add Lua-written commands to their shell without making\na separate script in a bin folder. Instead, you may simply use the Commander\nlibrary in your Hilbish config.\n\n```lua\nlocal commander = require 'commander'\n\ncommander.register('hello', function(args, sinks)\n\tsinks.out:writeln 'Hello world!'\nend)\n```\n\nIn this example, a command with the name of `hello` is created\nthat will print `Hello world!` to output. One question you may\nhave is: What is the `sinks` parameter?\\\n \\\nThe `sinks` parameter is a table with 3 keys: `input`, `out`, and `err`.\nThere is an `in` alias to `input`, but it requires using the string accessor syntax (`sinks['in']`)\nas `in` is also a Lua keyword, so `input` is preferred for use.\nAll of them are a @Sink.\nIn the future, `sinks.in` will be removed.\\\n \\\n- `in` is the standard input. You may use the read functions on this sink to get input from the user.\n- `out` is standard output. This is usually where command output should go.\n- `err` is standard error. This sink is for writing errors, as the name would suggest.",
|
||||||
"properties": [],
|
"properties": [],
|
||||||
"fields": [],
|
"fields": [],
|
||||||
"docs": [
|
"docs": [
|
||||||
|
@ -13,15 +13,16 @@ menu:
|
|||||||
Bait is the event emitter for Hilbish. Much like Node.js and
|
Bait is the event emitter for Hilbish. Much like Node.js and
|
||||||
its `events` system, many actions in Hilbish emit events.
|
its `events` system, many actions in Hilbish emit events.
|
||||||
Unlike Node.js, Hilbish events are global. So make sure to
|
Unlike Node.js, Hilbish events are global. So make sure to
|
||||||
pick a unique name!
|
pick a unique name!\
|
||||||
|
\
|
||||||
Usage of the Bait module consists of userstanding
|
Usage of the Bait module consists of userstanding
|
||||||
event-driven architecture, but it's pretty simple:
|
event-driven architecture, but it's pretty simple:
|
||||||
If you want to act on a certain event, you can `catch` it.
|
If you want to act on a certain event, you can `catch` it.
|
||||||
You can act on events via callback functions.
|
You can act on events via callback functions.\
|
||||||
|
\
|
||||||
Examples of this are in the Hilbish default config!
|
Examples of this are in the Hilbish default config!
|
||||||
Consider this part of it:
|
Consider this part of it:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
bait.catch('command.exit', function(code)
|
bait.catch('command.exit', function(code)
|
||||||
running = false
|
running = false
|
||||||
@ -40,24 +41,24 @@ this function will set the user prompt.
|
|||||||
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#catch">catch(name, cb)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#catch">catch(name, cb)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Catches an event. This function can be used to act on events.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Catches an event. This function can be used to act on events.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#catchOnce">catchOnce(name, cb)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#catchOnce">catchOnce(name, cb)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Catches an event, but only once. This will remove the hook immediately after it runs for the first time.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Catches an event, but only once. This will remove the hook immediately after it runs for the first time.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#hooks">hooks(name) -> table</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#hooks">hooks(name) -> table</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Returns a table of functions that are hooked on an event with the corresponding `name`.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Returns a table of functions that are hooked on an event with the corresponding `name`.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#release">release(name, catcher)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#release">release(name, catcher)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Removes the `catcher` for the event with `name`.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Removes the `catcher` for the event with `name`.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#throw">throw(name, ...args)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#throw">throw(name, ...args)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Throws a hook with `name` with the provided `args`.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Throws a hook with `name` with the provided `args`.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -75,6 +76,7 @@ bait.catch(name, cb)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -106,6 +108,7 @@ bait.catchOnce(name, cb)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -130,6 +133,7 @@ bait.hooks(name) -> table
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -151,6 +155,7 @@ bait.release(name, catcher)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -188,6 +193,7 @@ bait.throw(name, ...args)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -25,20 +25,17 @@ end)
|
|||||||
|
|
||||||
In this example, a command with the name of `hello` is created
|
In this example, a command with the name of `hello` is created
|
||||||
that will print `Hello world!` to output. One question you may
|
that will print `Hello world!` to output. One question you may
|
||||||
have is: What is the `sinks` parameter?
|
have is: What is the `sinks` parameter?\
|
||||||
|
\
|
||||||
The `sinks` parameter is a table with 3 keys: `input`, `out`, and `err`.
|
The `sinks` parameter is a table with 3 keys: `input`, `out`, and `err`.
|
||||||
There is an `in` alias to `input`, but it requires using the string accessor syntax (`sinks['in']`)
|
There is an `in` alias to `input`, but it requires using the string accessor syntax (`sinks['in']`)
|
||||||
as `in` is also a Lua keyword, so `input` is preferred for use.
|
as `in` is also a Lua keyword, so `input` is preferred for use.
|
||||||
All of them are a @Sink.
|
All of them are a @Sink.
|
||||||
In the future, `sinks.in` will be removed.
|
In the future, `sinks.in` will be removed.\
|
||||||
|
\
|
||||||
- `in` is the standard input.
|
- `in` is the standard input. You may use the read functions on this sink to get input from the user.
|
||||||
You may use the read functions on this sink to get input from the user.
|
- `out` is standard output. This is usually where command output should go.
|
||||||
- `out` is standard output.
|
- `err` is standard error. This sink is for writing errors, as the name would suggest.
|
||||||
This is usually where command output should go.
|
|
||||||
- `err` is standard error.
|
|
||||||
This sink is for writing errors, as the name would suggest.
|
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
@ -47,16 +44,16 @@ This sink is for writing errors, as the name would suggest.
|
|||||||
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#deregister">deregister(name)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#deregister">deregister(name)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Removes the named command. Note that this will only remove Commander-registered commands.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Removes the named command. Note that this will only remove Commander-registered commands.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#register">register(name, cb)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#register">register(name, cb)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Adds a new command with the given `name`. When Hilbish has to run a command with a name,</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Adds a new command with the given `name`. When Hilbish has to run a command with a name,</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#registry">registry() -> table</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#registry">registry() -> table</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Returns all registered commanders. Returns a list of tables with the following keys:</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Returns all registered commanders. Returns a list of tables with the following keys:</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -74,6 +71,7 @@ commander.deregister(name)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -95,6 +93,7 @@ commander.register(name, cb)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -132,6 +131,7 @@ commander.registry() -> table
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -21,44 +21,44 @@ library offers more functions and will work on any operating system Hilbish does
|
|||||||
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#abs">abs(path) -> string</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#abs">abs(path) -> string</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Returns an absolute version of the `path`.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Returns an absolute version of the `path`.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#basename">basename(path) -> string</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#basename">basename(path) -> string</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Returns the "basename," or the last part of the provided `path`. If path is empty,</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Returns the "basename," or the last part of the provided `path`. If path is empty,</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#cd">cd(dir)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#cd">cd(dir)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Changes Hilbish's directory to `dir`.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Changes Hilbish's directory to `dir`.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#dir">dir(path) -> string</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#dir">dir(path) -> string</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Returns the directory part of `path`. If a file path like</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Returns the directory part of `path`. If a file path like</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#glob">glob(pattern) -> matches (table)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#glob">glob(pattern) -> matches (table)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Match all files based on the provided `pattern`.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Match all files based on the provided `pattern`.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#join">join(...path) -> string</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#join">join(...path) -> string</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Takes any list of paths and joins them based on the operating system's path separator.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Takes any list of paths and joins them based on the operating system's path separator.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#mkdir">mkdir(name, recursive)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#mkdir">mkdir(name, recursive)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Creates a new directory with the provided `name`.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Creates a new directory with the provided `name`.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#pipe">fpipe() -> File, File</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#pipe">fpipe() -> File, File</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Returns a pair of connected files, also known as a pipe.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Returns a pair of connected files, also known as a pipe.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#readdir">readdir(path) -> table[string]</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#readdir">readdir(path) -> table[string]</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Returns a list of all files and directories in the provided path.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Returns a list of all files and directories in the provided path.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#stat">stat(path) -> {}</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#stat">stat(path) -> {}</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Returns the information about a given `path`.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Returns the information about a given `path`.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -72,8 +72,8 @@ library offers more functions and will work on any operating system Hilbish does
|
|||||||
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>pathSep</td>
|
<td class='p-3 font-medium text-black dark:text-white'>pathSep</td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>The operating system's path separator.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>The operating system's path separator.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -91,6 +91,7 @@ fs.abs(path) -> string
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -113,6 +114,7 @@ fs.basename(path) -> string
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -135,6 +137,7 @@ fs.cd(dir)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -156,6 +159,7 @@ fs.dir(path) -> string
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -178,6 +182,7 @@ fs.glob(pattern) -> matches (table)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -214,6 +219,7 @@ fs.join(...path) -> string
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -242,6 +248,7 @@ fs.mkdir(name, recursive)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -274,6 +281,7 @@ fs.fpipe() -> File, File
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -294,6 +302,7 @@ fs.readdir(path) -> table[string]
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -315,6 +324,7 @@ fs.stat(path) -> {}
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -18,68 +18,68 @@ menu:
|
|||||||
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#alias">alias(cmd, orig)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#alias">alias(cmd, orig)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Sets an alias, with a name of `cmd` to another command.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Sets an alias, with a name of `cmd` to another command.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#appendPath">appendPath(dir)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#appendPath">appendPath(dir)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Appends the provided dir to the command path (`$PATH`)</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Appends the provided dir to the command path (`$PATH`)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#complete">complete(scope, cb)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#complete">complete(scope, cb)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Registers a completion handler for the specified scope.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Registers a completion handler for the specified scope.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#cwd">cwd() -> string</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#cwd">cwd() -> string</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Returns the current directory of the shell.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Returns the current directory of the shell.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#exec">exec(cmd)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#exec">exec(cmd)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Replaces the currently running Hilbish instance with the supplied command.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Replaces the currently running Hilbish instance with the supplied command.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#goro">goro(fn)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#goro">goro(fn)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Puts `fn` in a Goroutine.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Puts `fn` in a Goroutine.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#highlighter">highlighter(line)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#highlighter">highlighter(line)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Line highlighter handler.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Line highlighter handler.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#hinter">hinter(line, pos)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#hinter">hinter(line, pos)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>The command line hint handler. It gets called on every key insert to</td>
|
<td class='p-3 font-medium text-black dark:text-white'>The command line hint handler. It gets called on every key insert to</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#inputMode">inputMode(mode)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#inputMode">inputMode(mode)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Sets the input mode for Hilbish's line reader.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Sets the input mode for Hilbish's line reader.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#interval">interval(cb, time) -> @Timer</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#interval">interval(cb, time) -> @Timer</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Runs the `cb` function every specified amount of `time`.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Runs the `cb` function every specified amount of `time`.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#multiprompt">multiprompt(str)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#multiprompt">multiprompt(str)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Changes the text prompt when Hilbish asks for more input.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Changes the text prompt when Hilbish asks for more input.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#prependPath">prependPath(dir)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#prependPath">prependPath(dir)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Prepends `dir` to $PATH.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Prepends `dir` to $PATH.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#prompt">prompt(str, typ)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#prompt">prompt(str, typ)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Changes the shell prompt to the provided string.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Changes the shell prompt to the provided string.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#read">read(prompt) -> input (string)</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#read">read(prompt) -> input (string)</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Read input from the user, using Hilbish's line editor/input reader.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Read input from the user, using Hilbish's line editor/input reader.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#timeout">timeout(cb, time) -> @Timer</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#timeout">timeout(cb, time) -> @Timer</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Executed the `cb` function after a period of `time`.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Executed the `cb` function after a period of `time`.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#which">which(name) -> string</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#which">which(name) -> string</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Checks if `name` is a valid command.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Checks if `name` is a valid command.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -97,6 +97,7 @@ hilbish.alias(cmd, orig)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -131,6 +132,7 @@ hilbish.appendPath(dir)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -164,6 +166,7 @@ hilbish.complete(scope, cb)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -219,6 +222,7 @@ hilbish.cwd() -> string
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -238,6 +242,7 @@ hilbish.exec(cmd)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -260,6 +265,7 @@ hilbish.goro(fn)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -284,6 +290,7 @@ hilbish.highlighter(line)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -319,6 +326,7 @@ hilbish.hinter(line, pos)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -355,6 +363,7 @@ hilbish.inputMode(mode)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -378,6 +387,7 @@ hilbish.interval(cb, time) -> @Timer
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -403,6 +413,7 @@ hilbish.multiprompt(str)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -444,6 +455,7 @@ hilbish.prependPath(dir)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -465,6 +477,7 @@ hilbish.prompt(str, typ)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -503,6 +516,7 @@ hilbish.read(prompt) -> input (string)
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -526,6 +540,7 @@ hilbish.timeout(cb, time) -> @Timer
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -551,6 +566,7 @@ hilbish.which(name) -> string
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ is usable at `hilbish.editor`.
|
|||||||
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#New">new() -> @Readline</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#New">new() -> @Readline</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Creates a new readline instance.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Creates a new readline instance.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -41,6 +41,7 @@ readline.new() -> @Readline
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ Hilbish functions.
|
|||||||
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#new">new() -> @Snail</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#new">new() -> @Snail</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Creates a new Snail instance.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Creates a new Snail instance.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -40,6 +40,7 @@ snail.new() -> @Snail
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -18,20 +18,20 @@ The terminal library is a simple and lower level library for certain terminal in
|
|||||||
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#restoreState">restoreState()</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#restoreState">restoreState()</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Restores the last saved state of the terminal</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Restores the last saved state of the terminal</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#saveState">saveState()</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#saveState">saveState()</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Saves the current state of the terminal.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Saves the current state of the terminal.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#setRaw">setRaw()</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#setRaw">setRaw()</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Puts the terminal into raw mode.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Puts the terminal into raw mode.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#size">size()</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#size">size()</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Gets the dimensions of the terminal. Returns a table with `width` and `height`</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Gets the dimensions of the terminal. Returns a table with `width` and `height`</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -49,6 +49,7 @@ terminal.restoreState()
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -68,6 +69,7 @@ terminal.saveState()
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -87,6 +89,7 @@ terminal.setRaw()
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -106,6 +109,7 @@ terminal.size()
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@ t 'printing from another lua state!'
|
|||||||
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#thread">thread(fun) -> @Thread</a></td>
|
<td class='p-3 font-medium text-black dark:text-white'><a href="#thread">thread(fun) -> @Thread</a></td>
|
||||||
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Creates a new, fresh Yarn thread.</td>
|
<td class='p-3 font-medium text-black dark:text-white'>Creates a new, fresh Yarn thread.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -49,6 +49,7 @@ yarn.thread(fun) -> @Thread
|
|||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -3,15 +3,14 @@
|
|||||||
Bait is the event emitter for Hilbish. Much like Node.js and
|
Bait is the event emitter for Hilbish. Much like Node.js and
|
||||||
its `events` system, many actions in Hilbish emit events.
|
its `events` system, many actions in Hilbish emit events.
|
||||||
Unlike Node.js, Hilbish events are global. So make sure to
|
Unlike Node.js, Hilbish events are global. So make sure to
|
||||||
pick a unique name!
|
pick a unique name!<nl>
|
||||||
|
|
||||||
Usage of the Bait module consists of userstanding
|
Usage of the Bait module consists of userstanding
|
||||||
event-driven architecture, but it's pretty simple:
|
event-driven architecture, but it's pretty simple:
|
||||||
If you want to act on a certain event, you can `catch` it.
|
If you want to act on a certain event, you can `catch` it.
|
||||||
You can act on events via callback functions.
|
You can act on events via callback functions.<nl>
|
||||||
|
|
||||||
Examples of this are in the Hilbish default config!
|
Examples of this are in the Hilbish default config!
|
||||||
Consider this part of it:
|
Consider this part of it:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
bait.catch('command.exit', function(code)
|
bait.catch('command.exit', function(code)
|
||||||
running = false
|
running = false
|
||||||
@ -30,11 +29,12 @@ import (
|
|||||||
|
|
||||||
"hilbish/util"
|
"hilbish/util"
|
||||||
|
|
||||||
rt "github.com/arnodel/golua/runtime"
|
|
||||||
"github.com/arnodel/golua/lib/packagelib"
|
"github.com/arnodel/golua/lib/packagelib"
|
||||||
|
rt "github.com/arnodel/golua/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
type listenerType int
|
type listenerType int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
goListener listenerType = iota
|
goListener listenerType = iota
|
||||||
luaListener
|
luaListener
|
||||||
@ -93,8 +93,10 @@ func (b *Bait) Emit(event string, args ...interface{}) []rt.Value {
|
|||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
var luarg rt.Value
|
var luarg rt.Value
|
||||||
switch arg.(type) {
|
switch arg.(type) {
|
||||||
case rt.Value: luarg = arg.(rt.Value)
|
case rt.Value:
|
||||||
default: luarg = rt.AsValue(arg)
|
luarg = arg.(rt.Value)
|
||||||
|
default:
|
||||||
|
luarg = rt.AsValue(arg)
|
||||||
}
|
}
|
||||||
luaArgs = append(luaArgs, luarg)
|
luaArgs = append(luaArgs, luarg)
|
||||||
}
|
}
|
||||||
@ -208,7 +210,6 @@ func (b *Bait) addListener(event string, listener *Listener) {
|
|||||||
b.handlers[event] = append(b.handlers[event], listener)
|
b.handlers[event] = append(b.handlers[event], listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (b *Bait) removeListener(event string, idx int) {
|
func (b *Bait) removeListener(event string, idx int) {
|
||||||
b.handlers[event][idx] = b.handlers[event][len(b.handlers[event])-1]
|
b.handlers[event][idx] = b.handlers[event][len(b.handlers[event])-1]
|
||||||
|
|
||||||
@ -294,7 +295,9 @@ func (b *Bait) bhooks(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
|||||||
|
|
||||||
luaHandlers := rt.NewTable()
|
luaHandlers := rt.NewTable()
|
||||||
for _, handler := range handlers {
|
for _, handler := range handlers {
|
||||||
if handler.typ != luaListener { continue }
|
if handler.typ != luaListener {
|
||||||
|
continue
|
||||||
|
}
|
||||||
luaHandlers.Set(rt.IntValue(luaHandlers.Len()+1), rt.FunctionValue(handler.luaCaller))
|
luaHandlers.Set(rt.IntValue(luaHandlers.Len()+1), rt.FunctionValue(handler.luaCaller))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,29 +15,24 @@ end)
|
|||||||
|
|
||||||
In this example, a command with the name of `hello` is created
|
In this example, a command with the name of `hello` is created
|
||||||
that will print `Hello world!` to output. One question you may
|
that will print `Hello world!` to output. One question you may
|
||||||
have is: What is the `sinks` parameter?
|
have is: What is the `sinks` parameter?<nl>
|
||||||
|
|
||||||
The `sinks` parameter is a table with 3 keys: `input`, `out`, and `err`.
|
The `sinks` parameter is a table with 3 keys: `input`, `out`, and `err`.
|
||||||
There is an `in` alias to `input`, but it requires using the string accessor syntax (`sinks['in']`)
|
There is an `in` alias to `input`, but it requires using the string accessor syntax (`sinks['in']`)
|
||||||
as `in` is also a Lua keyword, so `input` is preferred for use.
|
as `in` is also a Lua keyword, so `input` is preferred for use.
|
||||||
All of them are a @Sink.
|
All of them are a @Sink.
|
||||||
In the future, `sinks.in` will be removed.
|
In the future, `sinks.in` will be removed.<nl>
|
||||||
|
- `in` is the standard input. You may use the read functions on this sink to get input from the user.
|
||||||
- `in` is the standard input.
|
- `out` is standard output. This is usually where command output should go.
|
||||||
You may use the read functions on this sink to get input from the user.
|
- `err` is standard error. This sink is for writing errors, as the name would suggest.
|
||||||
- `out` is standard output.
|
|
||||||
This is usually where command output should go.
|
|
||||||
- `err` is standard error.
|
|
||||||
This sink is for writing errors, as the name would suggest.
|
|
||||||
*/
|
*/
|
||||||
package commander
|
package commander
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"hilbish/util"
|
|
||||||
"hilbish/golibs/bait"
|
"hilbish/golibs/bait"
|
||||||
|
"hilbish/util"
|
||||||
|
|
||||||
rt "github.com/arnodel/golua/runtime"
|
|
||||||
"github.com/arnodel/golua/lib/packagelib"
|
"github.com/arnodel/golua/lib/packagelib"
|
||||||
|
rt "github.com/arnodel/golua/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Commander struct {
|
type Commander struct {
|
||||||
|
@ -4,23 +4,17 @@ description: Steps on how to install Hilbish on all the OSes and distros support
|
|||||||
layout: page
|
layout: page
|
||||||
---
|
---
|
||||||
|
|
||||||
|
There are a small amount of ways to grab Hilbish. You can download the releases from GitHub, use your package manager, or build from source.
|
||||||
|
|
||||||
## Official Binaries
|
## Official Binaries
|
||||||
|
|
||||||
The best way to get Hilbish is to get a build directly from GitHub.
|
The easiest way to get Hilbish is to get a build directly from GitHub.
|
||||||
|
|
||||||
At any time, there are 2 versions of Hilbish available to install:
|
At any time, there are 2 versions of Hilbish available to install:
|
||||||
the latest stable release, and development builds from the master branch.
|
the latest stable release, and development builds from the master branch.\
|
||||||
|
You can download both at any time, but note that the development builds may have breaking changes.\
|
||||||
|
To download the latest stable release, [see here](https://github.com/Rosettea/Hilbish/releases/latest)
|
||||||
|
|
||||||
You can download both at any time, but note that the development builds may
|
For the latest development build, [click here](https://nightly.link/Rosettea/Hilbish/workflows/build/master)
|
||||||
have breaking changes.
|
|
||||||
|
|
||||||
For the latest *stable release*, check here: https://github.com/Rosettea/Hilbish/releases/latest
|
|
||||||
|
|
||||||
For a *development build*: https://nightly.link/Rosettea/Hilbish/workflows/build/master
|
|
||||||
|
|
||||||
## Compiling
|
|
||||||
|
|
||||||
To read the steps for compiling Hilbish, head over to the [GitHub repository.](https://github.com/Rosettea/Hilbish#build)
|
|
||||||
|
|
||||||
## Package Repositories
|
## Package Repositories
|
||||||
|
|
||||||
@ -47,3 +41,7 @@ Or, from master branch: `yay -S hilbish-git`
|
|||||||
|
|
||||||
Hilbish is currentlty in the testing/edge repository for Alpine.
|
Hilbish is currentlty in the testing/edge repository for Alpine.
|
||||||
Follow the steps [here](https://wiki.alpinelinux.org/wiki/Enable_Community_Repository) (using testing repositories) and install: `apk add hilbish`
|
Follow the steps [here](https://wiki.alpinelinux.org/wiki/Enable_Community_Repository) (using testing repositories) and install: `apk add hilbish`
|
||||||
|
|
||||||
|
## Compiling From Source
|
||||||
|
|
||||||
|
To see steps on compiling Hilbish from source, [visit the GitHub repository](https://github.com/Rosettea/Hilbish#build)
|
||||||
|
@ -21,7 +21,7 @@ pub fn page(
|
|||||||
this_slug: String,
|
this_slug: String,
|
||||||
doc_pages_list,
|
doc_pages_list,
|
||||||
) -> element.Element(a) {
|
) -> element.Element(a) {
|
||||||
html.div([attribute.class("flex-auto flex flex-col overflow-none")], [
|
html.div([attribute.class("flex-1 flex flex-col overflow-hidden")], [
|
||||||
html.div(
|
html.div(
|
||||||
[
|
[
|
||||||
attribute.class(
|
attribute.class(
|
||||||
@ -43,7 +43,7 @@ pub fn page(
|
|||||||
html.span([attribute.class("font-bold")], [element.text(p.title)]),
|
html.span([attribute.class("font-bold")], [element.text(p.title)]),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
html.div([attribute.class("h-full sm:flex grid")], [
|
html.div([attribute.class("flex-1 sm:flex grid overflow-hidden")], [
|
||||||
html.input([
|
html.input([
|
||||||
attribute.type_("checkbox"),
|
attribute.type_("checkbox"),
|
||||||
attribute.id("sidebar-toggle"),
|
attribute.id("sidebar-toggle"),
|
||||||
@ -52,7 +52,7 @@ pub fn page(
|
|||||||
html.div(
|
html.div(
|
||||||
[
|
[
|
||||||
attribute.class(
|
attribute.class(
|
||||||
"p-4 sm:border-r sm:border-r-zinc-300 col-start-1 row-start-1 bg-neutral-100 dark:bg-neutral-950 basis-2/10 transition-transform duration-300 -translate-x-full peer-checked:translate-x-0 sm:translate-x-0 z-30",
|
"overflow-y-scroll p-4 sm:border-r sm:border-r-zinc-300 col-start-1 row-start-1 bg-neutral-100 dark:bg-neutral-950 basis-2/10 transition-transform duration-300 -translate-x-full peer-checked:translate-x-0 sm:translate-x-0 z-30",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -187,18 +187,24 @@ pub fn page(
|
|||||||
html.main(
|
html.main(
|
||||||
[
|
[
|
||||||
attribute.class(
|
attribute.class(
|
||||||
"mb-4 h-full overflow-y-auto basis-7/7 col-start-1 row-start-1 transition-all duration-300 peer-checked:filter peer-checked:blur-sm peer-checked:bg-black/30 px-4 pt-2",
|
"flex-1 flex justify-center basis-7/7 col-start-1 row-start-1 transition-all duration-300 peer-checked:filter peer-checked:blur-sm peer-checked:bg-black/30",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
html.h1([attribute.class("my-3 font-bold text-4xl")], [
|
html.div([attribute.class("flex-1 flex flex-col overflow-y-auto")], [
|
||||||
element.text(p.title),
|
|
||||||
]),
|
|
||||||
// todo: add date of publishing
|
// todo: add date of publishing
|
||||||
//html.time([], [])
|
//html.time([], [])
|
||||||
//html.small([], [element.text({{p.contents |> string.split(" ") |> list.length} / 200} |> int.to_string <> " min read")]),
|
//html.small([], [element.text({{p.contents |> string.split(" ") |> list.length} / 200} |> int.to_string <> " min read")]),
|
||||||
//element.unsafe_raw_html("namespace", "Tag", [], render_doc(p.contents))
|
//element.unsafe_raw_html("namespace", "Tag", [], render_doc(p.contents))
|
||||||
|
html.div([attribute.class("flex-1 w-3/4 self-center p-8")], [
|
||||||
|
html.h1([attribute.class("my-3 font-bold text-4xl")], [
|
||||||
|
element.text(p.title),
|
||||||
|
]),
|
||||||
|
html.i([], [element.text(p.description)]),
|
||||||
..render_doc(p.contents)
|
..render_doc(p.contents)
|
||||||
|
]),
|
||||||
|
util.footer(),
|
||||||
|
]),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
@ -218,7 +224,8 @@ fn render_doc(md: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let margin = case level {
|
let margin = case level {
|
||||||
1 -> "my-2"
|
1 -> "my-4"
|
||||||
|
2 -> "my-2"
|
||||||
_ -> "my-1"
|
_ -> "my-1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@ pub fn page() -> element.Element(a) {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
html.div([attribute.class("gap-1 flex flex-col items-center")], [
|
html.div(
|
||||||
|
[attribute.class("gap-1 flex flex-col items-center text-center")],
|
||||||
|
[
|
||||||
html.span(
|
html.span(
|
||||||
[attribute.class("flex flex-row items-center justify-center")],
|
[attribute.class("flex flex-row items-center justify-center")],
|
||||||
[
|
[
|
||||||
@ -30,7 +32,8 @@ pub fn page() -> element.Element(a) {
|
|||||||
html.p([attribute.class("text-6xl font-light")], [
|
html.p([attribute.class("text-6xl font-light")], [
|
||||||
element.text("Something Unique."),
|
element.text("Something Unique."),
|
||||||
]),
|
]),
|
||||||
]),
|
],
|
||||||
|
),
|
||||||
html.p([attribute.class("text-center")], [
|
html.p([attribute.class("text-center")], [
|
||||||
element.text(
|
element.text(
|
||||||
"Hilbish is the new Moon-powered interactive shell for Lua fans!",
|
"Hilbish is the new Moon-powered interactive shell for Lua fans!",
|
||||||
@ -55,7 +58,7 @@ pub fn page() -> element.Element(a) {
|
|||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
html.div([attribute.class("text-center")], [
|
html.div([attribute.class("py-4 text-center border-b border-b-zinc-300")], [
|
||||||
html.span(
|
html.span(
|
||||||
[
|
[
|
||||||
attribute.class(
|
attribute.class(
|
||||||
@ -68,14 +71,14 @@ pub fn page() -> element.Element(a) {
|
|||||||
html.div(
|
html.div(
|
||||||
[
|
[
|
||||||
attribute.class(
|
attribute.class(
|
||||||
"flex flex-col justify-center items-center gap-6 mt-4",
|
"min-h-screen flex flex-col justify-around items-center gap-6",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
html.h1(
|
html.h1(
|
||||||
[
|
[
|
||||||
attribute.class(
|
attribute.class(
|
||||||
"mt-3 text-5xl gap-2 font-bold inline-flex justify-center items-center",
|
"mt-3 text-5xl gap-2 font-bold inline-flex flex-wrap justify-center items-center",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -133,7 +136,7 @@ pub fn page() -> element.Element(a) {
|
|||||||
html.div(
|
html.div(
|
||||||
[
|
[
|
||||||
attribute.class(
|
attribute.class(
|
||||||
"border-t border-t-zinc-300 text-center bg-neutral-100 dark:bg-neutral-900 -mx-4 p-4",
|
"-mx-4 px-4 py-8 -mt-4 text-center border-b border-b-zinc-300 bg-neutral-100 dark:bg-neutral-900",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -145,12 +148,15 @@ pub fn page() -> element.Element(a) {
|
|||||||
],
|
],
|
||||||
[element.text("Download It Now!")],
|
[element.text("Download It Now!")],
|
||||||
),
|
),
|
||||||
html.div([attribute.class("flex flex-col items-center mt-4 gap-2")], [
|
html.div(
|
||||||
|
[attribute.class("h-full flex flex-col items-center mt-8 gap-6")],
|
||||||
|
[
|
||||||
html.p([attribute.class("md:w-3/6")], [
|
html.p([attribute.class("md:w-3/6")], [
|
||||||
element.text(
|
element.text(
|
||||||
"To find out all that Hilbish can do, you should just try it out! It's officially available on Linux, MacOS, Windows, and probably builds on anything Go is available on!",
|
"To find out all that Hilbish can do, you should just try it out! It's officially available on Linux, MacOS, Windows, and probably builds on anything Go is available on!",
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
|
html.div([attribute.class("sm:w-1/2 text-center")], [
|
||||||
html.h2([attribute.class("text-3xl font-semibold")], [
|
html.h2([attribute.class("text-3xl font-semibold")], [
|
||||||
element.text("Featured Downloads"),
|
element.text("Featured Downloads"),
|
||||||
]),
|
]),
|
||||||
@ -159,6 +165,7 @@ pub fn page() -> element.Element(a) {
|
|||||||
"These are \"portable\" binary releases of Hilbish from GitHub. All the required files are in the archive. Put it somewhere, add the directory to your $PATH, and use Hilbish.",
|
"These are \"portable\" binary releases of Hilbish from GitHub. All the required files are in the archive. Put it somewhere, add the directory to your $PATH, and use Hilbish.",
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
|
]),
|
||||||
html.div(
|
html.div(
|
||||||
[
|
[
|
||||||
attribute.class(
|
attribute.class(
|
||||||
@ -166,12 +173,12 @@ pub fn page() -> element.Element(a) {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
html.div([attribute.class("flex flex-col gap-2")], [
|
html.div([attribute.class("flex flex-col gap-2 items-center")], [
|
||||||
html.img([
|
html.img([
|
||||||
attribute.src(
|
attribute.src(
|
||||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/1200px-Tux.svg.png",
|
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/1200px-Tux.svg.png",
|
||||||
),
|
),
|
||||||
attribute.class("h-36"),
|
attribute.class("h-28 w-fit"),
|
||||||
]),
|
]),
|
||||||
button(
|
button(
|
||||||
"Linux (64-bit)",
|
"Linux (64-bit)",
|
||||||
@ -179,12 +186,12 @@ pub fn page() -> element.Element(a) {
|
|||||||
download_link("linux", "amd64"),
|
download_link("linux", "amd64"),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
html.div([attribute.class("flex flex-col gap-2")], [
|
html.div([attribute.class("flex flex-col gap-2 items-center")], [
|
||||||
html.img([
|
html.img([
|
||||||
attribute.src(
|
attribute.src(
|
||||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Unofficial_Windows_logo_variant_-_2002%E2%80%932012_%28Multicolored%29.svg/2321px-Unofficial_Windows_logo_variant_-_2002%E2%80%932012_%28Multicolored%29.svg.png",
|
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Unofficial_Windows_logo_variant_-_2002%E2%80%932012_%28Multicolored%29.svg/2321px-Unofficial_Windows_logo_variant_-_2002%E2%80%932012_%28Multicolored%29.svg.png",
|
||||||
),
|
),
|
||||||
attribute.class("h-36"),
|
attribute.class("h-28 h-28 w-fit"),
|
||||||
]),
|
]),
|
||||||
button(
|
button(
|
||||||
"Windows (64-bit)",
|
"Windows (64-bit)",
|
||||||
@ -203,7 +210,7 @@ pub fn page() -> element.Element(a) {
|
|||||||
attribute.src(
|
attribute.src(
|
||||||
"https://images.seeklogo.com/logo-png/38/2/apple-mac-os-logo-png_seeklogo-381401.png",
|
"https://images.seeklogo.com/logo-png/38/2/apple-mac-os-logo-png_seeklogo-381401.png",
|
||||||
),
|
),
|
||||||
attribute.class("h-36"),
|
attribute.class("h-28 h-28 w-fit"),
|
||||||
]),
|
]),
|
||||||
button(
|
button(
|
||||||
"MacOS (64-bit)",
|
"MacOS (64-bit)",
|
||||||
@ -223,7 +230,7 @@ pub fn page() -> element.Element(a) {
|
|||||||
attribute.src(
|
attribute.src(
|
||||||
"https://images.seeklogo.com/logo-png/38/2/apple-mac-os-logo-png_seeklogo-381401.png",
|
"https://images.seeklogo.com/logo-png/38/2/apple-mac-os-logo-png_seeklogo-381401.png",
|
||||||
),
|
),
|
||||||
attribute.class("h-36"),
|
attribute.class("h-28 h-28 w-fit"),
|
||||||
]),
|
]),
|
||||||
button(
|
button(
|
||||||
"MacOS (ARM)",
|
"MacOS (ARM)",
|
||||||
@ -235,7 +242,8 @@ pub fn page() -> element.Element(a) {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
util.link(conf.base_url_join("/install"), "Other Downloads", True),
|
util.link(conf.base_url_join("/install"), "Other Downloads", True),
|
||||||
]),
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
|
@ -4,6 +4,7 @@ import gleam/option
|
|||||||
pub type Post {
|
pub type Post {
|
||||||
Post(
|
Post(
|
||||||
name: String,
|
name: String,
|
||||||
|
description: String,
|
||||||
title: String,
|
title: String,
|
||||||
slug: String,
|
slug: String,
|
||||||
metadata: option.Option(glaml.Document),
|
metadata: option.Option(glaml.Document),
|
||||||
|
@ -6,6 +6,7 @@ import lustre/attribute
|
|||||||
import lustre/element
|
import lustre/element
|
||||||
import lustre/element/html
|
import lustre/element/html
|
||||||
|
|
||||||
|
import conf
|
||||||
import glaml
|
import glaml
|
||||||
import post
|
import post
|
||||||
|
|
||||||
@ -68,3 +69,77 @@ pub fn link(url: String, text: String, out: Bool) {
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn nav() -> element.Element(a) {
|
||||||
|
html.nav(
|
||||||
|
[
|
||||||
|
attribute.class(
|
||||||
|
"bg-stone-100/80 dark:bg-neutral-950/80 flex justify-around sticky items-center top-0 w-full z-50 border-b border-b-zinc-300 backdrop-blur-md h-12",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
html.div([attribute.class("flex my-auto px-2")], [
|
||||||
|
html.div([], [
|
||||||
|
html.a(
|
||||||
|
[
|
||||||
|
attribute.href(conf.base_url_join("/")),
|
||||||
|
attribute.class("flex items-center gap-1"),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
html.img([
|
||||||
|
attribute.src(conf.base_url_join("/hilbish-flower.png")),
|
||||||
|
attribute.class("h-8"),
|
||||||
|
]),
|
||||||
|
html.span([attribute.class("self-center text-3xl font-medium")], [
|
||||||
|
element.text("Hilbish"),
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
html.div([attribute.class("flex gap-3")], [
|
||||||
|
link(conf.base_url_join("/install"), "Install", False),
|
||||||
|
link(conf.base_url_join("/docs"), "Docs", False),
|
||||||
|
link(conf.base_url_join("/blog"), "Blog", False),
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn footer() -> element.Element(a) {
|
||||||
|
html.footer(
|
||||||
|
[
|
||||||
|
attribute.class(
|
||||||
|
"py-4 px-6 flex flex-row justify-around border-t border-t-zinc-300",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
html.div([attribute.class("flex flex-col")], [
|
||||||
|
html.a(
|
||||||
|
[
|
||||||
|
attribute.href(conf.base_url),
|
||||||
|
attribute.class("flex items-center gap-1"),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
html.img([
|
||||||
|
attribute.src(conf.base_url_join("/hilbish-flower.png")),
|
||||||
|
attribute.class("h-24"),
|
||||||
|
]),
|
||||||
|
html.span([attribute.class("self-center text-6xl")], [
|
||||||
|
element.text("Hilbish"),
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
html.span([attribute.class("text-xl")], [
|
||||||
|
element.text("The Moon-powered shell!"),
|
||||||
|
]),
|
||||||
|
html.span([attribute.class("text-light text-neutral-500")], [
|
||||||
|
element.text("MIT License, copyright sammyette 2025"),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
html.div([attribute.class("flex flex-col")], [
|
||||||
|
link("https://github.com/Rosettea/Hilbish", "GitHub", True),
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -56,8 +56,20 @@ pub fn main() {
|
|||||||
option.None -> ""
|
option.None -> ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let description = case metadata {
|
||||||
|
option.Some(metadata) -> {
|
||||||
|
case
|
||||||
|
glaml.select_sugar(glaml.document_root(metadata), "description")
|
||||||
|
{
|
||||||
|
Ok(glaml.NodeStr(s)) -> s
|
||||||
|
_ -> ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
option.None -> ""
|
||||||
|
}
|
||||||
|
|
||||||
let assert Ok(filename) = path |> string.split("/") |> list.last
|
let assert Ok(filename) = path |> string.split("/") |> list.last
|
||||||
#(slug, post.Post(name, title, slug, metadata, content))
|
#(slug, post.Post(name, description, title, slug, metadata, content))
|
||||||
})
|
})
|
||||||
|
|
||||||
let doc_pages =
|
let doc_pages =
|
||||||
@ -78,14 +90,18 @@ pub fn main() {
|
|||||||
let build =
|
let build =
|
||||||
ssg.new("./public")
|
ssg.new("./public")
|
||||||
|> ssg.add_static_dir("static")
|
|> ssg.add_static_dir("static")
|
||||||
|> ssg.add_static_route("/", create_page(index.page()))
|
|> ssg.add_static_route("/", create_page(index.page(), False))
|
||||||
|> list.fold(posts, _, fn(config, post) {
|
|> list.fold(posts, _, fn(config, post) {
|
||||||
let page = case is_doc_page(post.0) {
|
let page = case is_doc_page(post.0) {
|
||||||
True -> doc.page(post.1, post.0, doc_pages)
|
True -> doc.page(post.1, post.0, doc_pages)
|
||||||
False -> doc.page(post.1, post.0, doc_pages)
|
False -> doc.page(post.1, post.0, doc_pages)
|
||||||
}
|
}
|
||||||
//io.debug(post.0)
|
//io.debug(post.0)
|
||||||
ssg.add_static_route(config, post.0, create_page(page))
|
ssg.add_static_route(
|
||||||
|
config,
|
||||||
|
post.0,
|
||||||
|
create_page(page, is_doc_page(post.0)),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|> ssg.use_index_routes
|
|> ssg.use_index_routes
|
||||||
|> ssg.build
|
|> ssg.build
|
||||||
@ -106,78 +122,10 @@ fn is_doc_page(slug: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn nav() -> element.Element(a) {
|
fn create_page(
|
||||||
html.nav(
|
content: element.Element(a),
|
||||||
[
|
doc_page: Bool,
|
||||||
attribute.class(
|
) -> element.Element(a) {
|
||||||
"bg-stone-100/80 dark:bg-neutral-950/80 flex justify-around sticky items-center top-0 w-full z-50 border-b border-b-zinc-300 backdrop-blur-md h-12",
|
|
||||||
),
|
|
||||||
],
|
|
||||||
[
|
|
||||||
html.div([attribute.class("flex my-auto px-2")], [
|
|
||||||
html.div([], [
|
|
||||||
html.a(
|
|
||||||
[attribute.href("/"), attribute.class("flex items-center gap-1")],
|
|
||||||
[
|
|
||||||
html.img([
|
|
||||||
attribute.src(conf.base_url_join("/hilbish-flower.png")),
|
|
||||||
attribute.class("h-8"),
|
|
||||||
]),
|
|
||||||
html.span([attribute.class("self-center text-3xl font-medium")], [
|
|
||||||
element.text("Hilbish"),
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
html.div([attribute.class("flex gap-3")], [
|
|
||||||
util.link(conf.base_url_join("/install"), "Install", False),
|
|
||||||
util.link(conf.base_url_join("/docs"), "Docs", False),
|
|
||||||
util.link(conf.base_url_join("/blog"), "Blog", False),
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn footer() -> element.Element(a) {
|
|
||||||
html.footer(
|
|
||||||
[
|
|
||||||
attribute.class(
|
|
||||||
"py-4 px-6 flex flex-row justify-around border-t border-t-zinc-300",
|
|
||||||
),
|
|
||||||
],
|
|
||||||
[
|
|
||||||
html.div([attribute.class("flex flex-col")], [
|
|
||||||
html.a(
|
|
||||||
[
|
|
||||||
attribute.href(conf.base_url),
|
|
||||||
attribute.class("flex items-center gap-1"),
|
|
||||||
],
|
|
||||||
[
|
|
||||||
html.img([
|
|
||||||
attribute.src(conf.base_url_join("/hilbish-flower.png")),
|
|
||||||
attribute.class("h-24"),
|
|
||||||
]),
|
|
||||||
html.span([attribute.class("self-center text-6xl")], [
|
|
||||||
element.text("Hilbish"),
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
html.span([attribute.class("text-xl")], [
|
|
||||||
element.text("The Moon-powered shell!"),
|
|
||||||
]),
|
|
||||||
html.span([attribute.class("text-light text-neutral-500")], [
|
|
||||||
element.text("MIT License, copyright sammyette 2025"),
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
html.div([attribute.class("flex flex-col")], [
|
|
||||||
util.link("https://github.com/Rosettea/Hilbish", "GitHub", True),
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_page(content: element.Element(a)) -> element.Element(a) {
|
|
||||||
let description =
|
let description =
|
||||||
"Something Unique. Hilbish is the new interactive shell for Lua fans. Extensible, scriptable, configurable: All in Lua."
|
"Something Unique. Hilbish is the new interactive shell for Lua fans. Extensible, scriptable, configurable: All in Lua."
|
||||||
|
|
||||||
@ -236,10 +184,13 @@ fn create_page(content: element.Element(a)) -> element.Element(a) {
|
|||||||
attribute.attribute("property", "og:url"),
|
attribute.attribute("property", "og:url"),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
html.body([attribute.class("min-h-screen flex flex-col")], [
|
html.body([attribute.class("h-screen flex flex-col")], [
|
||||||
nav(),
|
util.nav(),
|
||||||
content,
|
content,
|
||||||
footer(),
|
case doc_page {
|
||||||
|
True -> element.none()
|
||||||
|
False -> util.footer()
|
||||||
|
},
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user