From 1cbfc35c7039894a70a54b8db452943fec95e144 Mon Sep 17 00:00:00 2001 From: sammy-ette Date: Sun, 22 Jun 2025 18:55:56 -0400 Subject: [PATCH] fix: descriptions --- defs/bait.json | 2 +- defs/commander.json | 2 +- defs/hilbish.json | 386 +++++++++++----------------------- docs/api/bait.md | 5 +- docs/api/commander.md | 5 +- docs/api/hilbish.md | 52 +---- golibs/bait/bait.go | 2 +- golibs/commander/commander.go | 3 +- website/src/conf.gleam | 4 +- 9 files changed, 136 insertions(+), 325 deletions(-) diff --git a/defs/bait.json b/defs/bait.json index 4114e680..3a7a9521 100644 --- a/defs/bait.json +++ b/defs/bait.json @@ -1,7 +1,7 @@ { "name": "bait", "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 \\\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 \\\n\nExamples of this are in the Hilbish default config!\nConsider this part of it:\\\n \\\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.", + "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": [], "fields": [], "docs": [ diff --git a/defs/commander.json b/defs/commander.json index 6d94813c..be7f510d 100644 --- a/defs/commander.json +++ b/defs/commander.json @@ -1,7 +1,7 @@ { "name": "commander", "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\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.", + "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": [], "fields": [], "docs": [ diff --git a/defs/hilbish.json b/defs/hilbish.json index c22a4228..f765506c 100644 --- a/defs/hilbish.json +++ b/defs/hilbish.json @@ -1,147 +1,9 @@ { "name": "hilbish", - "shortDescription": "the core Hilbish API", - "description": "The Hilbish module includes the core API, containing\ninterfaces and functions which directly relate to shell functionality.", + "shortDescription": "", + "description": "", "properties": [], - "fields": [ - { - "name": "ver", - "description": [ - "The", - "version", - "of", - "Hilbish" - ], - "isInterface": false, - "isMember": false, - "isType": false - }, - { - "name": "goVersion", - "description": [ - "The", - "version", - "of", - "Go", - "that", - "Hilbish", - "was", - "compiled", - "with" - ], - "isInterface": false, - "isMember": false, - "isType": false - }, - { - "name": "user", - "description": [ - "Username", - "of", - "the", - "user" - ], - "isInterface": false, - "isMember": false, - "isType": false - }, - { - "name": "host", - "description": [ - "Hostname", - "of", - "the", - "machine" - ], - "isInterface": false, - "isMember": false, - "isType": false - }, - { - "name": "dataDir", - "description": [ - "Directory", - "for", - "Hilbish", - "data", - "files,", - "including", - "the", - "docs", - "and", - "default", - "modules" - ], - "isInterface": false, - "isMember": false, - "isType": false - }, - { - "name": "interactive", - "description": [ - "Is", - "Hilbish", - "in", - "an", - "interactive", - "shell?" - ], - "isInterface": false, - "isMember": false, - "isType": false - }, - { - "name": "login", - "description": [ - "Is", - "Hilbish", - "the", - "login", - "shell?" - ], - "isInterface": false, - "isMember": false, - "isType": false - }, - { - "name": "vimMode", - "description": [ - "Current", - "Vim", - "input", - "mode", - "of", - "Hilbish", - "(will", - "be", - "nil", - "if", - "not", - "in", - "Vim", - "input", - "mode)" - ], - "isInterface": false, - "isMember": false, - "isType": false - }, - { - "name": "exitCode", - "description": [ - "Exit", - "code", - "of", - "the", - "last", - "executed", - "command" - ], - "isInterface": false, - "isMember": false, - "isType": false - } - ], + "fields": [], "types": [ { "name": "Sink", @@ -164,127 +26,6 @@ } ], "docs": [ - { - "name": "luaSinkAutoFlush", - "description": [ - "Sets/toggles the option of automatically flushing output.", - "A call with no argument will toggle the value." - ], - "signature": "autoFlush(auto)", - "goFuncName": "luasinkautoflush", - "isInterface": false, - "isMember": true, - "isType": false, - "tags": { - "member": [ - { - "id": "", - "fields": null, - "startIdx": 0 - } - ] - } - }, - { - "name": "luaSinkFlush", - "description": [ - "Flush writes all buffered input to the sink." - ], - "signature": "flush()", - "goFuncName": "luasinkflush", - "isInterface": false, - "isMember": true, - "isType": false, - "tags": { - "member": [ - { - "id": "", - "fields": null, - "startIdx": 0 - } - ] - } - }, - { - "name": "luaSinkRead", - "description": [ - "Reads a liine of input from the sink." - ], - "signature": "read() -\u003e string", - "goFuncName": "luasinkread", - "isInterface": false, - "isMember": true, - "isType": false, - "tags": { - "member": [ - { - "id": "", - "fields": null, - "startIdx": 0 - } - ] - } - }, - { - "name": "luaSinkReadAll", - "description": [ - "Reads all input from the sink." - ], - "signature": "readAll() -\u003e string", - "goFuncName": "luasinkreadall", - "isInterface": false, - "isMember": true, - "isType": false, - "tags": { - "member": [ - { - "id": "", - "fields": null, - "startIdx": 0 - } - ] - } - }, - { - "name": "luaSinkWrite", - "description": [ - "Writes data to a sink." - ], - "signature": "write(str)", - "goFuncName": "luasinkwrite", - "isInterface": false, - "isMember": true, - "isType": false, - "tags": { - "member": [ - { - "id": "", - "fields": null, - "startIdx": 0 - } - ] - } - }, - { - "name": "luaSinkWriteln", - "description": [ - "Writes data to a sink with a newline at the end." - ], - "signature": "writeln(str)", - "goFuncName": "luasinkwriteln", - "isInterface": false, - "isMember": true, - "isType": false, - "tags": { - "member": [ - { - "id": "", - "fields": null, - "startIdx": 0 - } - ] - } - }, { "name": "alias", "description": [ @@ -1128,6 +869,127 @@ } ] } + }, + { + "name": "luaSinkAutoFlush", + "description": [ + "Sets/toggles the option of automatically flushing output.", + "A call with no argument will toggle the value." + ], + "signature": "autoFlush(auto)", + "goFuncName": "luasinkautoflush", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "startIdx": 0 + } + ] + } + }, + { + "name": "luaSinkFlush", + "description": [ + "Flush writes all buffered input to the sink." + ], + "signature": "flush()", + "goFuncName": "luasinkflush", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "startIdx": 0 + } + ] + } + }, + { + "name": "luaSinkRead", + "description": [ + "Reads a liine of input from the sink." + ], + "signature": "read() -\u003e string", + "goFuncName": "luasinkread", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "startIdx": 0 + } + ] + } + }, + { + "name": "luaSinkReadAll", + "description": [ + "Reads all input from the sink." + ], + "signature": "readAll() -\u003e string", + "goFuncName": "luasinkreadall", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "startIdx": 0 + } + ] + } + }, + { + "name": "luaSinkWrite", + "description": [ + "Writes data to a sink." + ], + "signature": "write(str)", + "goFuncName": "luasinkwrite", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "startIdx": 0 + } + ] + } + }, + { + "name": "luaSinkWriteln", + "description": [ + "Writes data to a sink with a newline at the end." + ], + "signature": "writeln(str)", + "goFuncName": "luasinkwriteln", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "startIdx": 0 + } + ] + } } ], "interfaces": { diff --git a/docs/api/bait.md b/docs/api/bait.md index 1043c53a..c0ffd416 100644 --- a/docs/api/bait.md +++ b/docs/api/bait.md @@ -15,16 +15,13 @@ its `events` system, many actions in Hilbish emit events. Unlike Node.js, Hilbish events are global. So make sure to pick a unique name!\ \ - Usage of the Bait module consists of userstanding event-driven architecture, but it's pretty simple: If you want to act on a certain event, you can `catch` it. You can act on events via callback functions.\ \ - Examples of this are in the Hilbish default config! -Consider this part of it:\ - \ +Consider this part of it: ```lua bait.catch('command.exit', function(code) diff --git a/docs/api/commander.md b/docs/api/commander.md index 389ec162..22809572 100644 --- a/docs/api/commander.md +++ b/docs/api/commander.md @@ -13,8 +13,8 @@ menu: Commander is the library which handles Hilbish commands. This makes the user able to add Lua-written commands to their shell without making a separate script in a bin folder. Instead, you may simply use the Commander -library in your Hilbish config.\ - \ +library in your Hilbish config. + ```lua local commander = require 'commander' @@ -33,7 +33,6 @@ as `in` is also a Lua keyword, so `input` is preferred for use. All of them are a @Sink. In the future, `sinks.in` will be removed.\ \ - - `in` is the standard input. 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. - `err` is standard error. This sink is for writing errors, as the name would suggest. diff --git a/docs/api/hilbish.md b/docs/api/hilbish.md index acb95f53..6330ee2c 100644 --- a/docs/api/hilbish.md +++ b/docs/api/hilbish.md @@ -1,6 +1,6 @@ --- title: Module hilbish -description: the core Hilbish API +description: layout: doc menu: docs: @@ -9,8 +9,7 @@ menu: ## Introduction -The Hilbish module includes the core API, containing -interfaces and functions which directly relate to shell functionality. + ## Functions @@ -87,53 +86,6 @@ interfaces and functions which directly relate to shell functionality. ``` -## Static module fields - -``` =html -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
verThe version of Hilbish
goVersionThe version of Go that Hilbish was compiled with
userUsername of the user
hostHostname of the machine
dataDirDirectory for Hilbish data files, including the docs and default modules
interactiveIs Hilbish in an interactive shell?
loginIs Hilbish the login shell?
vimModeCurrent Vim input mode of Hilbish (will be nil if not in Vim input mode)
exitCodeExit code of the last executed command
-
-``` - ## Functions ``` =html diff --git a/golibs/bait/bait.go b/golibs/bait/bait.go index b042de71..285330b5 100644 --- a/golibs/bait/bait.go +++ b/golibs/bait/bait.go @@ -9,7 +9,7 @@ event-driven architecture, but it's pretty simple: If you want to act on a certain event, you can `catch` it. You can act on events via callback functions. Examples of this are in the Hilbish default config! -Consider this part of it: +Consider this part of it: ```lua bait.catch('command.exit', function(code) diff --git a/golibs/commander/commander.go b/golibs/commander/commander.go index 660a0e76..c7e62539 100644 --- a/golibs/commander/commander.go +++ b/golibs/commander/commander.go @@ -3,7 +3,8 @@ Commander is the library which handles Hilbish commands. This makes the user able to add Lua-written commands to their shell without making a separate script in a bin folder. Instead, you may simply use the Commander -library in your Hilbish config. +library in your Hilbish config. + ```lua local commander = require 'commander' diff --git a/website/src/conf.gleam b/website/src/conf.gleam index 47905211..07591469 100644 --- a/website/src/conf.gleam +++ b/website/src/conf.gleam @@ -1,6 +1,6 @@ -pub const base_url = "https://rosettea.github.io/Hilbish/versions/new-website" +//pub const base_url = "https://rosettea.github.io/Hilbish/versions/new-website" -//pub const base_url = "http://localhost:9080" +pub const base_url = "http://localhost:9080" pub fn base_url_join(cont: String) -> String { base_url <> cont