Compare commits

..

4 Commits

Author SHA1 Message Date
sammyette ea233facc8
fix: get absolute path in fs.cd function 2024-07-27 14:28:09 -04:00
sammyette 19feda919e
chore: update changelog 2024-07-27 14:27:54 -04:00
sammyette e4df61f020
fix(nature/tips): cleanup tips display 2024-07-27 14:19:53 -04:00
sammyette 54b85b1c99
fix: add 2.3 motd 2024-07-27 14:10:21 -04:00
5 changed files with 37 additions and 27 deletions

View File

@ -1,9 +1,15 @@
# 🎀 Changelog # 🎀 Changelog
## Unreleased ## [2.3.1] - 2024-07-27
[hehe when you see it release](https://youtu.be/AaAF51Gwbxo?si=rhj2iYuQRkqDa693&t=64)
### Added ### Added
- `nature.opts.tips` was added to randomly generate tips on start up. - `nature.opts.tips` was added to display random tips on start up.
Follows the pattern of motd and greeting. Displays after greeting on start up. Displayed tips can be modified via the `hilbish.tips` table.
### Fixed
- Fix a minor regression related to the cd command not working with relative paths
- Updated the motd for 2.3
## [2.3.0] - 2024-07-20 ## [2.3.0] - 2024-07-20
### Added ### Added
@ -763,6 +769,7 @@ This input for example will prompt for more input to complete:
First "stable" release of Hilbish. First "stable" release of Hilbish.
[2.3.1]: https://github.com/Rosettea/Hilbish/compare/v2.3.0...v2.3.1
[2.3.0]: https://github.com/Rosettea/Hilbish/compare/v2.2.3...v2.3.0 [2.3.0]: https://github.com/Rosettea/Hilbish/compare/v2.2.3...v2.3.0
[2.2.3]: https://github.com/Rosettea/Hilbish/compare/v2.2.2...v2.2.3 [2.2.3]: https://github.com/Rosettea/Hilbish/compare/v2.2.2...v2.2.3
[2.2.2]: https://github.com/Rosettea/Hilbish/compare/v2.2.1...v2.2.2 [2.2.2]: https://github.com/Rosettea/Hilbish/compare/v2.2.1...v2.2.2

View File

@ -110,11 +110,12 @@ func (f *fs) fcd(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
} }
path = util.ExpandHome(strings.TrimSpace(path)) path = util.ExpandHome(strings.TrimSpace(path))
abspath, _ := filepath.Abs(path)
err = os.Chdir(path) err = os.Chdir(path)
if err != nil { if err != nil {
return nil, err return nil, err
} }
interp.Dir(path)(f.runner) interp.Dir(abspath)(f.runner)
return c.Next(), err return c.Next(), err
} }

View File

@ -19,7 +19,7 @@ commander.register('cd', function (args, sinks)
dirs.setOld(hilbish.cwd()) dirs.setOld(hilbish.cwd())
dirs.push(path) dirs.push(path)
local ok, err = pcall(function() fs.cd(fs.abs(path)) end) local ok, err = pcall(function() fs.cd(path) end)
if not ok then if not ok then
sinks.out:writeln(err) sinks.out:writeln(err)
return 1 return 1

View File

@ -2,8 +2,9 @@ local bait = require 'bait'
local lunacolors = require 'lunacolors' local lunacolors = require 'lunacolors'
hilbish.motd = [[ hilbish.motd = [[
Finally at {red}v2.2!{reset} So much {green}documentation improvements{reset} Wait ... {magenta}2.3{reset} is basically the same as {red}2.2?{reset}
and 1 single fix for Windows! {blue}.. and a feature they can't use.{reset} Erm.. {blue}Ctrl-C works for Commanders,{reset} {cyan}and the sh runner has some fixes.{reset}
Just trust me bro, this is an imporant bug fix release. {red}- 🌺 sammyette{reset}
]] ]]
bait.catch('hilbish.init', function() bait.catch('hilbish.init', function()

View File

@ -1,34 +1,35 @@
local bait = require 'bait' local bait = require 'bait'
local lunacolors = require 'lunacolors' local lunacolors = require 'lunacolors'
PREAMBLE = [[ local postamble = [[
Getting Started: https://rosettea.github.io/Hilbish/docs/getting-started/ {yellow}These tips can be disabled with {reset}{invert} hilbish.opts.tips = false {reset}
{yellow}🛈 These tips can be disabled with hilbish.opts.tips = false{reset}
]] ]]
hilbish.tips = { hilbish.tips = {
"Join the discord and say hi! -> https://discord.gg/3PDdcQz", 'Join the discord and say hi! {blue}https://discord.gg/3PDdcQz{reset}',
"{green}hilbish.alias{reset} -> Sets an alias to another cmd", '{green}hilbish.alias{reset} interface manages shell aliases. See more detail by running {blue}doc api hilbish.alias.',
"{green}hilbish.appendPath{reset} -> Appends the provided dir to the command path ($PATH)", '{green}hilbish.appendPath(\'path\'){reset} -> Appends the provided dir to the command path ($PATH)',
"{green}hilbish.completions{reset} -> Are use to control suggestions when tab completing.", '{green}hilbish.completions{reset} -> Used to control suggestions when tab completing.',
"{green}hilbish.message{reset} -> Simple notification system which can be used by other plugins and parts of the shell to notify the user of various actions.", '{green}hilbish.message{reset} -> Simple notification system which can be used by other plugins and parts of the shell to notify the user of various actions.',
[[ [[
{green}hilbish.opts{reset} -> Simple toggle or value options a user can set. {green}hilbish.opts{reset} -> Simple toggle or value options a user can set.
- EX: hilbish.opts.greeting = false, will cause the greeting message on start-up to not display. You may disable the startup greeting by {invert}hilbish.opts.greeting = false{reset}
]], ]],
[[ [[
{green}hilbish.runner{reset} -> The runner interface contains functions that allow the user to change how Hilbish interprets interactive input. {green}hilbish.runner{reset} -> The runner interface contains functions to
- The default runners can run shell script and Lua code. manage how Hilbish interprets interactive input. The default runners can run
shell script and Lua code!
]], ]],
[[ [[
Add Lua-written commands with the commander module! Add Lua-written commands with the commander module!
Checkout the docs here -> https://rosettea.github.io/Hilbish/docs/api/commander/ Check the command {blue}doc api commander{reset} or the web docs:
https://rosettea.github.io/Hilbish/docs/api/commander/
]] ]]
} }
bait.catch('hilbish.init', function() bait.catch('hilbish.init', function()
if hilbish.interactive and hilbish.opts.tips then if hilbish.interactive and hilbish.opts.tips then
local idx = math.random(1, #hilbish.tips) local idx = math.random(1, #hilbish.tips)
print(lunacolors.format(PREAMBLE .. "\nTip: " .. hilbish.tips[idx])) print(lunacolors.format('{yellow}🛈 Tip:{reset} ' .. hilbish.tips[idx] .. '\n' .. postamble))
end end
end) end)