Commit Graph

171 Commits (4178b78341d002957beaf950bef9dd0973d664d9)

Author SHA1 Message Date
TorchedSammy bcf02a6b0e
fix: make custom hist dir match default by adding hilbish to the path 2022-04-23 23:55:04 -04:00
Will Eccles e34ab5314a
fix: make macOS config path match Linux (#143)
Also moves some variables around in vars_*.go to accommodate the fix.
2022-04-19 22:12:05 -04:00
TorchedSammy 0ae31123b9
fix: make expand home actually expand and not do the opposite 2022-04-19 22:05:48 -04:00
TorchedSammy d4084a82ba
fix: expandHome function using hist dir instead of passed arg 2022-04-19 21:23:48 -04:00
TorchedSammy e3fdf84f5c
fix!: make path to script the 0th arg instead of 1st
makes more sense, brings some lua parity
this means that user passed args start from 1
instead of 2
2022-04-13 20:19:28 -04:00
TorchedSammy c95ff42dee
feat: add timer pool and api (closes #135)
adds a map (but lets call it a pool) of all
running timers. this makes us able to keep
track of all running intervals and timeouts.
it also means hilbish can wait for them to
be done before exiting (it only waits when
non interactive).

this introduces the `hilbish.timers` interface,
documented by `doc timers`. the `hilbish.interval`
and `hilbish.timeout` functions return a timer
object now.
2022-04-12 19:31:48 -04:00
sammyette 0fc5f457ad
refactor!: support lua 5.4 (#129)
major rewrite which changes the library hilbish uses for it's lua vm
this one implements lua 5.4, and since that's a major version bump,
it's a breaking change. introduced here also is a fix for `hilbish.login`
not being the right value

* refactor: start work on lua 5.4

lots of commented out code

ive found a go lua library which implements lua 5.4
and found an opportunity to start working on it.
this commit basically removes everything and just leaves
enough for the shell to be "usable" and able to start.
there are no builtins or libraries (besides the `hilbish` global)

* fix: call cont next in prompt function

this continues execution of lua, very obvious
fixes an issue with code stopping at the prompt function

* fix: handle errors in user config

* fix: handle panic in lua input if it is incorrect

* feat: implement bait

* refactor: use util funcs to run lua where possible

* refactor: move arg handle function to util

* feat: implement commander

* feat: implement fs

* feat: add hilbish module functions used by prelude

* chore: use custom fork of golua

* fix: make sure args to setenv are strings in prelude

* feat: implement completions

* chore: remove comment

* feat: implement terminal

* feat: implement hilbish.interval

* chore: update lunacolors

* chore: update golua

* feat: implement aliases

* feat: add input mode

* feat: implement runner mode

* style: use comma separated cases instead of fallthrough

* feat: implement syntax highlight and hints

* chore: add comments to document util functions

* chore: fix dofile comment doc

* refactor: make loader functions for go modules unexported

* feat: implement job management

* feat: add hilbish properties

* feat: implement all hilbish module functions

* feat: implement history interface

* feat: add completion interface

* feat: add module description docs

* feat: implement os interface

* refactor: use hlalias for add function in hilbish.alias interface

* feat: make it so hilbish.run can return command output

* fix: set hilbish.exitCode to last command exit code

* fix(ansikit): flush on io.write

* fix: deregister commander if return isnt number

* feat: run script when provided path

* fix: read file manually in DoFile to avoid shebang

* chore: add comment for reason of unreading byte

* fix: remove prelude error printing

* fix: add names at chunk load for context in errors

* fix: add newline at the beginning of file buffer when there is shebang

this makes the line count in error messages line up properly

* fix: remove extra newline after error
2022-04-04 06:40:02 -04:00
TorchedSammy 96c1487bfa
fix: make sure complete input is added to history 2022-03-19 18:48:03 -04:00
TorchedSammy f73c6d4aa8
fix: completions of executables and running absolute paths on windows 2022-03-17 20:22:30 -04:00
TorchedSammy 92d0e195ab
fix: change prompt back to user's prompt on contine prompt exit 2022-03-17 19:49:33 -04:00
TorchedSammy ece5f92307
fix: create history dir if it doesnt exist (fixes #113) 2022-03-12 21:50:57 -04:00
TorchedSammy 4a4cb3409f
fix: set running to true before throwing exit hook on no input
this fixes an issue with the prompt being kind of a mess when
enter alone is pressed (and hilbish doesn't try to run anything)
2022-03-07 21:01:21 -04:00
TorchedSammy 738939e4c9
fix: remove duplicate binary suggestions (fixes #105) 2022-03-07 18:56:22 -04:00
TorchedSammy 605574f262
fix: create directory for hist dir if it doesnt exist 2022-03-06 21:44:46 -04:00
TorchedSammy ec886e17fa
fix: dont refresh prompt at startup 2022-03-06 17:20:41 -04:00
TorchedSammy 539cf402ca
fix: dont double set prompt 2022-03-06 17:08:53 -04:00
TorchedSammy 4364031b16
fix!: change config path when custom config dir is used to be init.lua instead of .hilbishrc.lua 2022-03-06 14:39:23 -04:00
TorchedSammy 4ef6c7d5c0
fix: hilbish.read overriding history 2022-03-06 14:38:27 -04:00
TorchedSammy 3805f13369
feat: throw hilbish.exit hook (closes #99) 2022-03-06 10:23:32 -04:00
TorchedSammy f1dfd59c4c
fix: add back prompt global var
fixes an issue with multiline prompt overriding user's prompt
permanently
2022-03-05 15:46:38 -04:00
TorchedSammy 6b9bbb615d
fix: handle prompt properly and remove global 2022-03-04 21:54:47 -04:00
TorchedSammy 36cd4d4123
fix: custom handle ctrl c from readline 2022-02-28 18:32:57 -04:00
TorchedSammy d355d02b93
fix: only notify ctrl c signal on windows 2022-02-28 16:15:08 -04:00
TorchedSammy d9d2152e04
fix: add full command after complete prompt to history 2022-02-27 19:12:58 -04:00
TorchedSammy 0b5bbcc73c
refactor!: remove .hprofile.lua
same reason as not using ~/.hilbishrc.lua, and also
the fact that users can now just check if
`hilbish.login` is true in their config which is
more organized
2022-02-26 12:14:26 -04:00
TorchedSammy 2a0cd1464a
fix: dont copy default conf to user dir
doing this prevents problems in later releases with breaking
changes (though this shouldnt be the case anymore)
2022-02-23 22:20:11 -04:00
TorchedSammy f05ab921d7
refactor!: use better default paths
~/.hilbishrc.lua has been removed and will no longer be loaded.
instead, $XDG_CONFIG_HOME/hilbish/init.lua is to be used

the history path has been changed to a more suited one.
on linux, it is in $XDG_DATA_HOME/hilbish/.hilbish-history,
or otherwise ~/.local/share/hilbish/.hilbish-history
2022-02-23 22:19:54 -04:00
TorchedSammy cb3d0a2e8e
fix: use os agnostic function to get config dir 2022-02-23 22:01:35 -04:00
TorchedSammy 209abfac77
fix: change default hist path to use hist name instead of config name 2022-02-23 21:29:37 -04:00
TorchedSammy 8c802a6e6b
feat: dont put input in history if it starts with a space 2022-01-27 16:28:29 -04:00
TorchedSammy 9cf03e37c4
fix: change hooks from signals to signal
drop the s, dont remember when i added it
it makes more sense and its what the docs have anyway
2022-01-26 15:18:54 -04:00
TorchedSammy e0b84aaff7
feat: emit sigusr1 and 2 signal hooks 2022-01-26 15:18:09 -04:00
TorchedSammy bcc249a4bd
feat: add aliases interface (closes #87 and #86)
500th commit!
adds the `hilbish.aliases` interface
it allows you to add, delete and get all aliases

there was also a slight refactor with alias resolving in this commit,
there is a single resolve function instead of duplicate code.
with consideration this could be exported to lua side,
but i see no reason for it
2021-12-14 20:54:23 -04:00
TorchedSammy bcfbb20685
fix: dont export lua init 2021-12-08 23:31:48 -04:00
TorchedSammy 5c6310b1ca
refactor: dont export functions and types 2021-12-06 17:21:31 -04:00
TorchedSammy eaaf17a792
fix: make table for `args` instead of using luar 2021-12-06 16:32:42 -04:00
TorchedSammy f60f61e616
style: remove new line 2021-12-06 16:26:51 -04:00
TorchedSammy 28fcdb3122
fix: take care of readline segfault, update deps 2021-12-06 16:24:25 -04:00
TorchedSammy 4e2e8ddf94
fix: revert "fix: resize if terminal has been resized during running command and fix readline segfault"
This reverts commit d270e8f66b.
causes breakage
2021-12-06 16:07:23 -04:00
TorchedSammy d270e8f66b
fix: resize if terminal has been resized during running command and fix readline segfault 2021-12-06 15:53:51 -04:00
TorchedSammy 6ac4aa50b3
fix: check if interactive when handling signals 2021-12-06 15:45:35 -04:00
TorchedSammy 2a71fb0075
fix!: change xdg config file to init.lua 2021-12-06 15:42:04 -04:00
TorchedSammy 2e21af4d6b
refactor: use curuser to get homedir everywhere 2021-12-01 18:31:04 -04:00
TorchedSammy effd028658
fix: substitution of home dir to ~ when names in path match it
fixes edge cases like `/mnt/home/user`
2021-12-01 18:30:03 -04:00
TorchedSammy ce0b2ab955
fix: dont print extra new line on ctrl+d in continue prompt 2021-11-28 10:44:02 -05:00
TorchedSammy af4c3885ae
feat: add signal hooks for sigint and sigwinch (#80) 2021-11-22 15:13:05 -05:00
TorchedSammy 123f8992b1
feat: add tab completion api
tab complete is better than it was before!
there is a new `complete` function which allows adding custom arguments
to complete specific functions.
hilbish will now also complete executables if it's the first input
argument (this also works with ./)
if no completion is added for a command, hilbish will just complete
files
2021-11-22 11:24:31 -05:00
TorchedSammy 77cc7fe24a
fix: only resize term if not running command 2021-11-22 10:41:27 -05:00
sammyette b008d48c60
fix: handle ctrl c properly when not interactive 2021-10-18 12:12:54 -04:00
sammyette 37610ad8b0
fix: remove extra newline on exit 2021-10-17 16:47:04 -04:00