Compare commits

...

4 Commits

Author SHA1 Message Date
sammyette aaeb19c164
Merge a24bca3258 into 1e01580d8f 2024-09-06 06:44:57 -04:00
ShalokShalom 1e01580d8f
docs: add info about runner mode (#325) 2024-08-31 18:05:24 -04:00
sammyette edbc758c67
docs: use only 1 screenshot 2024-08-31 16:50:58 -04:00
sammyette a24bca3258
fix!: get/set env variables via env table
this removes the old "virtual global table" which allows
getting environment variables via just their names in lua.

this means:
an environment variable (like TERM) would need to be accessed
via the `env` table instead of just using TERM in lua.

`TERM` -> `env.TERM`
they can also be set via `env.VARIABLE = 'value'
2024-05-02 22:09:04 -04:00
3 changed files with 22 additions and 37 deletions

View File

@ -13,19 +13,23 @@
<br> <br>
Hilbish is an extensible shell designed to be highly customizable. Hilbish is an extensible shell designed to be highly customizable.
It is configured in Lua and provides a good range of features.
It aims to be easy to use for anyone but powerful enough for It is configured in Lua, and provides a good range of features.
those who need it. It aims to be easy to use for anyone, and powerful enough for
those who need more.
The motivation for choosing Lua was that its simpler and better to use The motivation for choosing Lua was that its simpler and better to use
than old shell script. It's fine for basic interactive shell uses, than old shell scripts. It's fine for basic interactive shell uses,
but that's the only place Hilbish has shell script; everything else is Lua and supports [both Lua and Sh interactively](https://rosettea.github.io/Hilbish/docs/features/runner-mode/).
and aims to be infinitely configurable. If something isn't, open an issue!
That's the only place Hilbish can use traditional shell syntax though;
everything else is Lua and aims to be infinitely configurable.
If something isn't, open an issue!
# Screenshots # Screenshots
<div align="center"> <div align="center">
<img src="gallery/tab.png"> <img src="gallery/tab.png">
<img src="gallery/pillprompt.png">
</div> </div>
# Getting Hilbish # Getting Hilbish

10
nature/env.lua 100644
View File

@ -0,0 +1,10 @@
env = {}
setmetatable(env, {
__index = function(_, k)
return os.getenv(k)
end,
__newindex = function(_, k, v)
os.setenv(k, tostring(v))
end
})

View File

@ -24,6 +24,7 @@ require 'nature.opts'
require 'nature.vim' require 'nature.vim'
require 'nature.runner' require 'nature.runner'
require 'nature.hummingbird' require 'nature.hummingbird'
require 'nature.env'
local shlvl = tonumber(os.getenv 'SHLVL') local shlvl = tonumber(os.getenv 'SHLVL')
if shlvl ~= nil then if shlvl ~= nil then
@ -32,36 +33,6 @@ else
os.setenv('SHLVL', '0') os.setenv('SHLVL', '0')
end end
do
local virt_G = { }
setmetatable(_G, {
__index = function (_, key)
local got_virt = virt_G[key]
if got_virt ~= nil then
return got_virt
end
if type(key) == 'string' then
virt_G[key] = os.getenv(key)
end
return virt_G[key]
end,
__newindex = function (_, key, value)
if type(value) == 'string' then
os.setenv(key, value)
virt_G[key] = value
else
if type(virt_G[key]) == 'string' then
os.setenv(key, '')
end
virt_G[key] = value
end
end,
})
end
do do
local startSearchPath = hilbish.userDir.data .. '/hilbish/start/?/init.lua;' local startSearchPath = hilbish.userDir.data .. '/hilbish/start/?/init.lua;'
.. hilbish.userDir.data .. '/hilbish/start/?.lua' .. hilbish.userDir.data .. '/hilbish/start/?.lua'