diff --git a/lua.go b/lua.go index b4678ea..2636332 100644 --- a/lua.go +++ b/lua.go @@ -51,7 +51,7 @@ func luaInit() { // Add more paths that Lua can require from l.DoString("package.path = package.path .. " + requirePaths) - err := l.DoFile("preload.lua") + err := l.DoFile("prelude/init.lua") if err != nil { err = l.DoFile(preloadPath) if err != nil { diff --git a/preload.lua b/prelude/init.lua similarity index 77% rename from preload.lua rename to prelude/init.lua index 56d4679..a9935e6 100644 --- a/preload.lua +++ b/prelude/init.lua @@ -1,4 +1,5 @@ -- The preload file initializes everything else for our shell +local ansikit = require 'ansikit' local bait = require 'bait' local commander = require 'commander' local fs = require 'fs' @@ -138,6 +139,55 @@ Available sections: ]] print(table.concat(modules, ', ')) end) +local helpTexts = { +[[ +Hello there! Welcome to Hilbish, the comfy and nice little shell for +Lua users and fans. Hilbish is configured with Lua, and its +scripts are also in Lua. It also runs both Lua and shell script when +interactive (aka normal usage). +]], +[[ +What does that mean for you, the user? It means that if you prefer to +use Lua for scripting instead of shell script but still have ordinary +shell usage for interactive use. +]], +[[ +If this is your first time using Hilbish and Lua, check out the +Programming in Lua book here: https://www.lua.org/pil +After (or if you already know Lua) check out the doc command. +It is an in shell tool for documentation about Hilbish provided +functions and modules. +]], +[[ +If you've updated from a pre-1.0 version (0.7.1 as an example) +you'll want to move your config from ~/.hilbishrc.lua to +]] .. +hilbish.userDir.config .. '/hilbish/init.lua' .. +[[ + +and also change all global functions (prompt, alias) to be +in the hilbish module (hilbish.prompt, hilbish.alias as examples). + +Since 1.0 is a big release, you'll want to check the changelog +at https://github.com/Rosettea/Hilbish/releases/tag/v1.0.0 +to find more breaking changes. +]] +} +commander.register('guide', function() + ansikit.clear() + ansikit.cursorTo(0, 0) + for _, text in ipairs(helpTexts) do + print(text) + local out = hilbish.read('Hit enter to continue ') + ansikit.clear() + ansikit.cursorTo(0, 0) + if not out then + return + end + end + print 'Hope you enjoy using Hilbish!' +end) + do local virt_G = { } diff --git a/vars_darwin.go b/vars_darwin.go index c92bacb..c969639 100644 --- a/vars_darwin.go +++ b/vars_darwin.go @@ -15,6 +15,6 @@ var ( .. hilbish.userDir.config .. '/hilbish/?/?.lua;' .. hilbish.userDir.config .. '/hilbish/?.lua'` dataDir = "/usr/local/share/hilbish" - preloadPath = dataDir + "/preload.lua" + preloadPath = dataDir + "/prelude/init.lua" sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config ) diff --git a/vars_linux.go b/vars_linux.go index dbd2c95..4bb23d3 100644 --- a/vars_linux.go +++ b/vars_linux.go @@ -15,6 +15,6 @@ var ( .. hilbish.userDir.config .. '/hilbish/?/?.lua;' .. hilbish.userDir.config .. '/hilbish/?.lua'` dataDir = "/usr/share/hilbish" - preloadPath = dataDir + "/preload.lua" + preloadPath = dataDir + "/prelude/init.lua" sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config ) diff --git a/vars_windows.go b/vars_windows.go index d9809dd..0867480 100644 --- a/vars_windows.go +++ b/vars_windows.go @@ -9,6 +9,6 @@ var ( .. hilbish.userDir.config .. '\\Hilbish\\libs\\?\\?.lua;' .. hilbish.userDir.config .. '\\Hilbish\\libs\\?.lua;'` dataDir = "~\\Appdata\\Roaming\\Hilbish" // ~ and \ gonna cry? - preloadPath = dataDir + "\\preload.lua" + preloadPath = dataDir + "\\prelude\\init.lua" sampleConfPath = dataDir + "\\hilbishrc.lua" // Path to default/sample config )