mirror of https://github.com/Hilbis/Hilbish
Compare commits
No commits in common. "e4b92f5f95d01a99ef4bbdc81e293a627f66b9db" and "a8475cfa67cdc459f1c9dd7c3a7e0b1ab7018605" have entirely different histories.
e4b92f5f95
...
a8475cfa67
|
@ -9,6 +9,8 @@ local function doPrompt(fail)
|
|||
))
|
||||
end
|
||||
|
||||
print(lunacolors.format(hilbish.greeting))
|
||||
|
||||
doPrompt()
|
||||
|
||||
bait.catch('command.exit', function(code)
|
||||
|
|
|
@ -61,10 +61,6 @@ having and using multiple runners.
|
|||
- `fs.pathListSep` is the separator for $PATH env entries
|
||||
- Lua modules located in `hilbish.userDir.data .. '/hilbish/start'` (like `~/.local/share/hilbish/start/foo/init.lua`)
|
||||
will be ran on startup
|
||||
- `hilbish.init` hook, thrown after Hilbish has initialized Lua side
|
||||
- Message of the day on startup (`hilbish.motd`), mainly intended as quick
|
||||
small news pieces for releases. It is printed by default. To disable it,
|
||||
set `hilbish.opts.motd` to false.
|
||||
|
||||
### Changed
|
||||
- **Breaking Change:** Upgraded to Lua 5.4.
|
||||
|
@ -80,13 +76,12 @@ It can (at the moment) have 4 variables:
|
|||
User input has been added to the return to account for runners wanting to
|
||||
prompt for continued input, and to add it properly to history. `continue`
|
||||
got added so that it would be easier for runners to get continued input
|
||||
without having to actually handle it at all.
|
||||
without having to actually handle it at all.
|
||||
|
||||
- **Breaking Change:** Job objects and timers are now Lua userdata instead
|
||||
of a table, so their functions require you to call them with a colon instead
|
||||
of a dot. (ie. `job.stop()` -> `job:stop()`)
|
||||
- All `fs` module functions which take paths now implicitly expand ~ to home.
|
||||
- **Breaking Change:** `hilbish.greeting` has been moved to an opt (`hilbish.opts.greeting`) and is
|
||||
always printed by default. To disable it, set the opt to false.
|
||||
|
||||
### Fixed
|
||||
- If in Vim replace mode, input at the end of the line inserts instead of
|
||||
|
|
21
README.md
21
README.md
|
@ -66,7 +66,6 @@ If you're new to nix you should probably read up on how to do that [here](https:
|
|||
## Manual Build
|
||||
### Prerequisites
|
||||
- [Go 1.17+](https://go.dev)
|
||||
- [Task](https://taskfile.dev/#/)
|
||||
|
||||
### Build
|
||||
First, clone Hilbish. The recursive is required, as some Lua libraries
|
||||
|
@ -79,16 +78,30 @@ go get -d ./...
|
|||
|
||||
To build, run:
|
||||
```
|
||||
task
|
||||
make dev
|
||||
```
|
||||
|
||||
Or, if you want a stable branch, run these commands:
|
||||
```
|
||||
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
|
||||
task build
|
||||
make build
|
||||
```
|
||||
|
||||
After you did all that, run `sudo task install` to install Hilbish globally.
|
||||
After you did all that, run `sudo make install` to install Hilbish globally.
|
||||
|
||||
# Getting Started
|
||||
At startup, you should see a message which says to run a `guide` command.
|
||||
This guide is a *very* simple and basic step through text of what Hilbish is
|
||||
and where to find documentation.
|
||||
|
||||
Documentation is primarily viewed via the in shell `doc` command.
|
||||
Autogenerated function docs and general docs about other things are included
|
||||
there, so be sure to read it.
|
||||
|
||||
Using Hilbish is the same as using any other Linux shell, with an addition
|
||||
that you can also run Lua. Hilbish can also act as an enhanced Lua REPL
|
||||
via `hilbish.runnerMode 'lua'`. To switch back to normal, use
|
||||
`hilbish.runnerMode 'hybrid'`.
|
||||
|
||||
# Contributing
|
||||
Any kind of contributions are welcome! Hilbish is very easy to contribute to.
|
||||
|
|
6
api.go
6
api.go
|
@ -44,6 +44,7 @@ var exports = map[string]util.LuaExport{
|
|||
"which": {hlwhich, 1, false},
|
||||
}
|
||||
|
||||
var greeting string
|
||||
var hshMod *rt.Table
|
||||
var hilbishLoader = packagelib.Loader{
|
||||
Load: hilbishLoad,
|
||||
|
@ -102,6 +103,10 @@ func hilbishLoad(rtm *rt.Runtime) (rt.Value, func()) {
|
|||
username = strings.Split(username, "\\")[1] // for some reason Username includes the hostname on windows
|
||||
}
|
||||
|
||||
greeting = `Welcome to {magenta}Hilbish{reset}, {cyan}` + username + `{reset}.
|
||||
The nice lil shell for {blue}Lua{reset} fanatics!
|
||||
Check out the {blue}{bold}guide{reset} command to get started.
|
||||
`
|
||||
util.SetFieldProtected(fakeMod, mod, "ver", rt.StringValue(getVersion()), "Hilbish version")
|
||||
util.SetFieldProtected(fakeMod, mod, "user", rt.StringValue(username), "Username of user")
|
||||
util.SetFieldProtected(fakeMod, mod, "host", rt.StringValue(host), "Host name of the machine")
|
||||
|
@ -109,6 +114,7 @@ func hilbishLoad(rtm *rt.Runtime) (rt.Value, func()) {
|
|||
util.SetFieldProtected(fakeMod, mod, "dataDir", rt.StringValue(dataDir), "Directory for Hilbish's data files")
|
||||
util.SetFieldProtected(fakeMod, mod, "interactive", rt.BoolValue(interactive), "If this is an interactive shell")
|
||||
util.SetFieldProtected(fakeMod, mod, "login", rt.BoolValue(login), "Whether this is a login shell")
|
||||
util.SetFieldProtected(fakeMod, mod, "greeting", rt.StringValue(greeting), "Hilbish's welcome message for interactive shells. It has Lunacolors formatting.")
|
||||
util.SetFieldProtected(fakeMod, mod, "vimMode", rt.NilValue, "Current Vim mode of Hilbish (nil if not in Vim mode)")
|
||||
util.SetFieldProtected(fakeMod, mod, "exitCode", rt.IntValue(0), "Exit code of last exected command")
|
||||
util.Document(fakeMod, "Hilbish's core API, containing submodules and functions which relate to the shell itself.")
|
||||
|
|
1
main.go
1
main.go
|
@ -138,7 +138,6 @@ func main() {
|
|||
} else {
|
||||
runConfig(*configflag)
|
||||
}
|
||||
hooks.Em.Emit("hilbish.init")
|
||||
|
||||
if fileInfo, _ := os.Stdin.Stat(); (fileInfo.Mode() & os.ModeCharDevice) == 0 {
|
||||
scanner := bufio.NewScanner(bufio.NewReader(os.Stdin))
|
||||
|
|
|
@ -10,6 +10,7 @@ require 'nature.completions'
|
|||
require 'nature.opts'
|
||||
require 'nature.vim'
|
||||
require 'nature.runner'
|
||||
require 'nature.history'
|
||||
|
||||
local shlvl = tonumber(os.getenv 'SHLVL')
|
||||
if shlvl ~= nil then
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
local bait = require 'bait'
|
||||
local lunacolors = require 'lunacolors'
|
||||
|
||||
bait.catch('hilbish.init', function()
|
||||
if hilbish.interactive and type(hilbish.opts.greeting) == 'string' then
|
||||
print(lunacolors.format(hilbish.opts.greeting))
|
||||
end
|
||||
end)
|
|
@ -22,10 +22,6 @@ end
|
|||
local defaultOpts = {
|
||||
autocd = false,
|
||||
history = true
|
||||
greeting = string.format([[Welcome to {magenta}Hilbish{reset}, {cyan}%s{reset}.
|
||||
The nice lil shell for {blue}Lua{reset} fanatics!
|
||||
]], hilbish.user),
|
||||
motd = true
|
||||
}
|
||||
|
||||
for optsName, default in pairs(defaultOpts) do
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
local bait = require 'bait'
|
||||
local lunacolors = require 'lunacolors'
|
||||
|
||||
hilbish.motd = [[
|
||||
Hilbish 2.0 is a {red}major{reset} update! If your config doesn't work
|
||||
anymore, that will definitely be why! A MOTD, very message, much day.
|
||||
]]
|
||||
|
||||
bait.catch('hilbish.init', function()
|
||||
if hilbish.opts.motd then
|
||||
print(lunacolors.format(hilbish.motd))
|
||||
end
|
||||
end)
|
Loading…
Reference in New Issue