mirror of
https://github.com/sammy-ette/Hilbish
synced 2025-08-10 02:52:03 +00:00
25 KiB
25 KiB
🎀 Changelog
Unreleased
Added
- Inline hints, akin to fish and the others.
To make a handler for hint text, you can set the
hilbish.hinterfunction. For more info, look at its docs with thedoc hilbishcommand. - Syntax highlighting function. To make a handler for it, set
hilbish.highlighter. Same thing as the hinter, checkdoc hilbishfor more info/docs. - Ctrl+K deletes from the cursor to the end of the line. (#128)
- Alt+Backspace as an alternative of Ctrl+W to delete a word. (#132)
- Enhanced timer API (
doc timers) - Don't exit until intervals are stopped/finished when running a non interactive script.
- Ctrl+D deletes character below cursor if line isn't empty instead of exiting.
- Ctrl+Delete to forward delete a word.
- Right prompt (#140)
- Ctrl+_ to undo in Emacs input mode.
- Emacs style forward/backward word keybinds (#139)
hilbish.completion.callto call a completion handler (doc completions)hilbish.completion.handlerto set a custom handler for completions. This is for everything/anything as opposed to just adding a single command completion. #122fs.abs(path)to get absolute path.- Nature module (
doc nature) hilbish.jobs.add(cmdstr, args, execPath)to add a job to the job table.cmdstrwould be user input,argsis the args for the command (includes arg0) andexecPathis absolute path to command executablejob.addhook is thrown when a job is added. acts as a unique hook for jobshilbish.jobs.disown(id)anddisownbuiltin to disown a job.disownwithout arguments will disown the last job.hilbish.jobs.last()returns the last added job.- Job output (stdout/stderr) can now be obtained via the
stdoutandstderrfields on a job object. - Documentation for jobs is now available via
doc jobs. hilbish.alias.resolve(cmdstr)to resolve a command alias.hilbish.optsfor shell options. Currently, the only opt isautocd.hilbish.editorinterface for interacting with the line editor that Hilbish uses.hilbish.viminterface to dynamically get/set vim registers. Example usage:hilbish.vim.registers['a'] = 'hello'. You can also get the mode with it viahilbish.vim.modehilbish.versioninterface for more info about Hilbish's version. This includes git commit, branch, and (new!!) release name.
Changed
- Breaking Change: Upgraded to Lua 5.4. This is probably one of (if not the) biggest things in this release.
- Breaking Change: MacOS config paths now match Linux.
- Overrides on the
hilbishtable are no longer permitted. - Breaking Change: Runner functions are now required to return 3 values: user input, exit code, and error. 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.
- All
fsmodule functions which take paths now implicitly expand ~ to home.
Fixed
- If in Vim replace mode, input at the end of the line inserts instead of replacing the last character.
- Make forward delete work how its supposed to.
- Prompt refresh not working properly.
- Crashing on input in xterm. (#131)
- Make delete key work on st (#131)
hilbish.loginbeing the wrong value.- Put full input in history if prompted for continued input
- Don't put alias expanded command in history (sound familiar?)
- Handle cases of stdin being nonblocking (in the case of #130)
- Don't prompt for continued input if non interactive
- Don't insert unhandled control keys.
- Handle sh syntax error in alias
- Use invert for completion menu selection highlight instead of specific colors. Brings an improvement on light themes, or themes that don't follow certain color rules.
- Home/End keys now go to the actual start/end of the input.
- Input getting cut off on enter in certain cases.
- Go to the next line properly if input reaches end of terminal width.
- Cursor position with CJK characters. (#145)
- Files with same name as parent folder in completions getting cut off #136)
hilbish.whichnow works with commanders and aliases.- Background jobs no longer take stdin so they do not interfere with shell input.
- Completions are fixed in cases where the query/line is an alias alone where it can also resolve to the beginning of command names. (reference this commit) for explanation.
- Jobs now throw
job.doneand set running to false when stopped via Luajob.stopfunction. - Jobs are always started in sh exec handler now instead of only successful start.
- SIGTERM is handled properly now, which means stopping jobs and timers.
[1.2.0] - 2022-03-17
Added
- Job Management additions
job.startandjob.donehooks (doc hooks job)hilbish.jobsinterface (get(id)function gets a job object viaid,all()gets all)
- Customizable runner/exec mode
- However Hilbish runs interactive user input can now be changed Lua side (
doc runner-mode)
- However Hilbish runs interactive user input can now be changed Lua side (
Changed
vimModedoc is nowvim-mode
Fixed
- Make sure input which is supposed to go in history goes there
- Cursor is right at the end of input on history search
1.1.0 - 2022-03-17
Added
hilbish.vimActionhook (doc vimMode actions)command.not-executablehook (will replacecommand.no-permin a future release)
Fixed
- Check if interactive before adding to history
- Escape in vim mode exits all modes and not only insert
- Make 2nd line in prompt empty if entire prompt is 1 line
- Completion menu doesnt appear if there is only 1 result
- Ignore SIGQUIT, which caused a panic unhandled
- Remove hostname in greeting on Windows
- Handle PATH binaries properly on Windows
- Fix removal of dot in the beginning of folders/files that have them for file complete
- Fix prompt being set to the continue prompt even when exited
1.0.4 - 2022-03-12
Fixed
- Panic when history directory doesn't exist
1.0.3 - 2022-03-12
Fixed
- Removed duplicate executable suggestions
- User input is added to history now instead of what's ran by Hilbish
- Formatting issue with prompt on no input
1.0.2 - 2022-03-06
Fixed
- Cases where Hilbish's history directory doesn't exist will no longer cause a panic
1.0.1 - 2022-03-06
Fixed
- Using
hilbish.appendPathwill no longer result in string spam (debugging thing left being) - Prompt gets set properly on startup
1.0.0 - 2022-03-06
Added
- MacOS is now officialy supported, default compile time vars have been added for it
- Windows is properly supported as well
catchOnce()to bait - catches a hook oncehilbish.aliasesinterface - allows you to add, delete and list all aliases with Luahilbish.appendPath()can now take a table of arguments for ease of usehilbish.which(binName)acts as the which builtin for other shells, it finds the path tobinNamein $PATH- Signal hooks
sigusr1andsigusr2(unavailable on Windows) - Commands starting with a space won't be added to history
- Vim input mode
- Hilbish's input mode for text can now be changed to either Emacs
(like it always was) or Vim via
hilbish.inputMode() - Changing Vim mode throws a
hilbish.vimModehook - The current Vim mode is also accessible with the
hilbish.vimModeproperty
- Hilbish's input mode for text can now be changed to either Emacs
(like it always was) or Vim via
- Print errors in
hilbish.timeout()andhilbish.goro()callbacks hilbish.exithook is thrown when Hilbish is going to exithilbish.exitCodeproperty to get the exit code of the last executed commandscreenMainandscreenAltfunctions have been added to Ansikit to switch to the terminal's main and alt buffer respectively
Fixed
- Tab completion for executables
- Stop interval (
hilbish.interval()) when an error occurs - Errors in bait hooks no longer cause a panic, and remove the handler for the hook as well
- Formatting of home dir to ~
- Check if Hilbish is in interactive before trying to use its handlers for signals
- Global
argstable when running as script is no longer userdata - Home dir is now added to recent dirs (the case of cd with no arg)
indexsubdoc will no longer appear- Alias expansion with quotes
- Add full command to history in the case of incomplete input
hilbish.exec()now has a windows substitute- Fixed case of successful command after prompted for more input not writing to history
command.exitis thrown when sh input is incorrect and when command executed after continue prompt exits successfully
Changed
- The minimal config is truly minimal now
- Default config is no longer copied to user's config and is instead ran its location
Breaking Changes
(there were a lot...)
- Change default SHLVL to 0 instead of 1
- ~/.hilbishrc.lua will no longer be run by default, it now only uses the paths mentioned below.
- Changed Hilbish's config path to something more suited
according to the OS (
$XDG_CONFIG_HOME/hilbish/init.luaon Linux,~/Library/Application Support/hilbish/init.luaon MacOS and (%APPDATA%/hilbish/init.luaon Windows). Previously on Unix-like it was$XDG_CONFIG_HOME/hilbish/hilbishrc.lua - The history path has been changed to a better suited path.
On Linux, it is
$XDG_DATA_HOME/hilbish/.hilbish-historyand for others it is the config path. hilbish.xdgno longer exists, usehilbish.userDirinstead, as it functions the same but is OS agnostichilbish.flag()has been removed~/.hprofile.luahas been removed, instead check in your config ifhilbish.loginis truehilbish.complete()has had a slight refactor to fit with the new readline library. It now expects a table of "completion groups" which are just tables with thetypeanditemskeys. Here is a (more or less) complete example of how it works now:
Completer functions are now also expected to handle subcommands/subcompletionshilbish.complete('command.git', function() return { { items = { 'add', 'clone' }, type = 'grid' }, { items = { ['--git-dir'] = {'Description of flag'}, '-c' }, type = 'list' } } end)
0.7.1 - 2021-11-22
Fixed
- Tab complete absolute paths to binaries properly
- Allow execution of absolute paths to binaries (
06272778f8regression)
0.7.0 - 2021-11-22
Added
hilbish.interactiveandhilbish.loginproperties to figure out if Hilbish is interactive or a login shell, respectively.hilbish.readfunction to take input more elegantly than Lua'sio.read- Tab Completion Enhancements
- A new tab complete API has been added. It is the single
completefunction which takes a "scope" (example:command.<cmdname>) and a callback which is expected to return a table. Users can now add custom completions for specific commands. An example is:
Forcomplete('command.git', function() return { 'add', 'version', commit = { '--message', '--verbose', '<file>' } } end)git, Hilbish will complete commands add, version and commit. For the commit subcommand, it will complete the flags and/or files which<file>is used to represent.- Hilbish will now complete binaries in $PATH, or any executable to a path (like
./or../) - Files with spaces will be automatically put in quotes and completions will work for them now.
- A new tab complete API has been added. It is the single
prependPathfunction (#81)- Signal hooks (#80)
- This allows scripts to add their own way of handling terminal resizes (if you'd need that) or Ctrl-C
- Module properties (like
hilbish.ver) are documented with thedoccommand. - Document bait hooks
Fixed
- The prompt won't come up on terminal resize anymore.
appendPathshould work properly on Windows.- A panic when a commander has an error has been fixed.
0.6.1 - 2021-10-21
Fixed
- Require paths now use the
dataDirvariable so there is no need to change it anymore unless you want to add more paths - Remove double slash in XDG data require paths
- Ctrl+C is handled properly when not interactive and won't result in a panic anymore
- Commanders are handled by the sh interpreter library only now, so they work with sh syntax
Changed
- Error messages from
fsfunctions now include the path provided
0.6.0 - 2021-10-17
Added
- Hilbish will expand
~in the preloadPath and samplePathConf variables. These are for compile time. - On Windows, the hostname in
%uhas been removed. - Made it easier to compile on Windows by adding Windows-tailored vars and paths.
- Add require paths
./libs/?/?.lua - Hilbish will now respect $XDG_CONFIG_HOME and will load its config and history there first and use Lua libraries in there and $XDG_DATA_HOME if they are set. (#71)
- If not, Hilbish will still default to
~
- If not, Hilbish will still default to
- Added some new hooks
command.precmdis thrown right before Hilbish prompts for inputcommand.preexecis thrown right before Hilbish executes a command. It passes 2 arguments: the command as the user typed, and what Hilbish will actually execute (resolved alias)
hilbish.dataDiris now available to know the directory of Hilbish data files (default config, docs, preload, etc)- A
docgenprogram has been added tocmd/docgenin the GitHub repository, As the name suggests, it will output docs in adocsfolder for functions implemented in Go - All hilbish modules/libraries now have a
__docmetatable entry which is simply a short description of the module. fs.readdir(dir)has been added. It will return a table of files indir- Errors in the
fs.mkdirfunction are now handled. - Breaking Change:
fs.cdno longer returns a numeric code to indicate error. Instead, it returns an error message. - The
doccommand has been added to document functions of Hilbish libraries. Run the command for more details. link(url, text)has been added toansikit. It returns a string which can be printed to produce a hyperlink in a terminal. Note that not all terminals support this feature.- The Succulent library has been added. This includes more utility functions and expansions to the Lua standard library itself.
- The command string is now passed to the
command.exithook
Changed
- Hilbish won't print an extra newline at exit with ctrl + d
command.exitwith 0 exit code will now be thrown if input is nothing- Breaking Change:
fs.stathas been made better. It returns a proper table instead of userdata, and has fields instead of functions- It includes
name,modeas a octal representation in a string,isDir, andsize
- It includes
Fixed
timeout()is now blocking- Directories with spaces in them can now be
cd'd to - An alias with the same name as the command will now not cause a freeze (#73)
- Userdata is no longer returned in the following cases:
- Commander arguments
fsfunctions
0.5.1 - 2021-06-16
Added
- Add
~/.config/hilbishas a require path
Changed
cdhook is only thrown after directory has actually changed
Fixed
- Handle error in commander properly, preventing a panic from Lua
0.5.0 - 2021-06-12
An absolutely massive release. Probably the biggest yet, includes a bunch of fixes and new features and convenient additions to the Lua API.
Added
-nflag, which checks Lua for syntax errors without running itexec(command)function, acts like theexecbuiltin in sh- Example:
exec 'awesome'in an .xinitrc file with Hilbish as shebang
- Example:
- Commands from commander can now
returnan exit code
commander.register('false', function()
return 1
end)
When false is run, it will have the exit code of 1, this is shorter/easier than throwing the command.exit hook and can work if the functionality of that changes
- Added
-cdescription argsvariable, set when Hilbish runs a Lua script. It is an array that includes the execute path as the first argument- Lua code can be aliased
- Recursive aliases
- At the moment this only works for the first argument
- Hilbish can now be used with Hilbiline if compiled to do so (currently only for testing purposes)
goro(func)runs afunction in a goroutine. With channels that gopher-lua also provides, one can do parallelism and concurrency in Lua (but go style).coroutineno those dont exist they dont mattergorois easier
cd -will change to the previous directoryhilbish.cwd()gets the current working directorytimeout(func, time)works exactly like thesetTimeoutfunction in JavaScript. It will runfuncafter a period oftimein milliseconds.interval(func, time)works exactly like thesetIntervalfunction in JavaScripit. It will runfunceverytimemillisecondshilbish.homeis a crossplatform Lua alternative to get the home directory easily.commander.deregister(cmdName)de-registers any command defined with commander.
Changed
- Breaking Change: Move
_userand_verto a globalhilbishtable- Accessing username and Hilbish version is now done with
hilbish.userandhilbish.ver
- Accessing username and Hilbish version is now done with
hilbish.run(cmd)runs cmd with Hilbish's sh interpreter. Using this function instead ofos.executeensures that sh syntax works everywhere Hilbish does.hilbish.flag(flag)checks if flag has been passed to Hilbish.- Aliases now work with every command and not only the first one
- Therefore
alias1; alias2works now
- Therefore
command.not-foundhook$SHLVLis now incremented in Hilbish. If not a valid number, it will be changed to 1fs.mkdircan now make directories recursively if the 2nd argument is set totruefs.mkdir('path/to/dir', true)
- Hilbish runs a
preload.luafile in the current directory first, then falls back to the global preload. Before the order was reversed. - Check if aliased command is defined in Lua, so registered
commanders can be aliased - Add input to history before alias expansion. Basically, this adds the actual alias to history instead of the aliased command.
- Global preload path, require paths, default config directory and sample config directory can now be changed at compile time to help support other systems.
Fixed
cdnow exits with code1instead of the error code if it occurs- Don't append directory to $PATH with
appendPathif its already there - Continued input is no longer joined with a space unless explicitly wanted
- Hilbish won't try to go interactive if it isn't launched in a TTY (terminal)
- Ctrl+D on a continue prompt with no input no longer causes a panic
- Actually handle the
-h/--helpoption
0.4.0 - 2021-05-01
Added
- Ctrl C in the prompt now cancels/clear input (I've needed this for so long also)
- Made Hilbish act like a login shell on login
- If Hilbish is the login shell, or the
-l/--loginflags are used, Hilbish will use an additional~/.hprofile.luafile, you can use this to set environment variables once on login
- If Hilbish is the login shell, or the
-chas been added to run a single command (this works exactly like being in the prompt would, so Lua works as well)-i(also--interactive) has been added to force Hilbish to be an interactive shell in cases where it usually wont be (like with-c)- Use readline in continue prompt
- Added a
mulitlinehook that's thrown when in the continue/multiline prompt - Added
appendPathfunction to append a directory to$PATH~will be expanded to$HOMEas well
- A utility
string.splitfunction is now addedstring.split(str, delimiter)
- Added a
_uservariable to easily get current user's name
Changed
- BREAKING Change: Lunacolors has replaced ansikit for formatting colors, which means the format function has been removed from ansikit and moved to Lunacolors.
- Users must replace ansikit with
lunacolorsin their config files
- Users must replace ansikit with
- A getopt-like library is now used for command line flag parsing
cdbuiltin now supports using environment variables- This means you can now
cd $NVM_DIRas an example
- This means you can now
- Function arguments are now more strictly typed (
prompt(nil)wouldnt work now) - Other general code/style changes
Fixed
- Fix makefile adding Hilbish to
/etc/shellson everymake install
Since Lunacolors is a submodule, you may just want to completely reclone Hilbish recursively and then update (rerun make install)
Or instead of recloning, run git submodule update --init --recursive in Hilbish's git directory
0.3.2 - 2021-04-10
Added
- Add more functions to
ansikitmodule - Add functions
statandmkdirtofsmodule -Cflag to define path to config- Add require path
~/.local/share/hilbish/libs
Changed
- Continue to new line if output doesnt end with it
Observed:
0.3.1 - 2021-04-06
Fixed
- Fix
%uin prompt format being full name and instead make it actually username
0.3.0 - 2021-04-05
Added
- Added a
multipromptfunction to change the prompt of the multiline/continuation/newline prompt _vervariable to get Hilbish's version from Lua
Changed
- BREAKING Change: Removed Bait hooks
command.successandcommand.fail, there is now the single hookcommand.exit, with a single argument passed which the exit code of the command. Use this to determine if a command has failed or not (failure is code != 0) - BREAKING Change: The Ansikit function
texthas been renamed toformat. fs.cdnow throws an exception instead of silently failing, which you should handle withpcall- Enhancements to the
cdcommand:- With no arguments will move to $HOME
- Now throws a cd hook, with a single hook arg being the arguments to the command
- Now works for directories with spaces
- Lua input now throws a success hook if it succeeded
- Command history is now saved to
~/.hilbish-history - Globals defined in Lua that are strings will be defined as an env variable (#16)
- Input ending with
\will now go to a newline exitcommand is now written in Lua
Fixed
- Input is now trimmed
- Internals are slightly cleaned up and codebase split up
- Hilbish will now fall back to a builtin minimal config if the user's config has syntax errors on loading
- Commands defined in Lua now report the error to the user cleanly instead of panicking if it has occured
0.2.0 - 2021-03-31
Added
- Hooks (events) are the new and main thing in v0.2, you can now listen for hooks or cast out (emit) custom ones, via the bait package
^^to refer to the previous command. It's for the lazy hands like me, so I can do something likeENV=VAR ^^- Way more (more like any) comments in the core code.
Changed
- Prompt has been changed to have printf-like verbs to format. This makes it easier on the user's side to configure, and doesn't require hooks to change it for things like current directory.
- Default prompt's changed and the triangle changes color based on if command failed or not.
0.1.2 - 2021-03-24
Added
- Add Lua input to history
0.1.1 - 2021-03-24
Added
- Go to new line if sh input is incomplete
> for i in {1..5}
This input for example will prompt for more input to complete:
0.1.0 - 2021-03-24
Added
- Tab complete files
- Makefile installation
- sh support
0.0.12 - 2021-03-21
First "stable" release of Hilbish.