rosettea / hilbish Goto Github PK
View Code? Open in Web Editor NEW๐ The Moon-powered shell! A comfy and extensible shell for Lua fans! ๐บ โจ
Home Page: https://rosettea.github.io/Hilbish/
License: MIT License
๐ The Moon-powered shell! A comfy and extensible shell for Lua fans! ๐บ โจ
Home Page: https://rosettea.github.io/Hilbish/
License: MIT License
the title is pretty clear as day. right about now, the only type of ci or github actions is the semantic check for pr titles/commit messages and a compile on commit. i dont have an idea of useful ci, but i just thought to put the idea out
hilbish isnt tested on windows, since i don't have an install of it and don't want to bother getting it just to test.
the only problems seem to be the readline library dependency and hardcoded linux paths
idk about the detail i can give but hilbish should not try to go into an interactive session if:
input is piped to it
just not launched in a terminal
code reference:
https://rosettacode.org/wiki/Check_output_device_is_a_terminal#Go
when ran as a shebang or whatever hilbish should provide the args
variable
as what is somewhat obvious this will be an array of arguments the user provides
if no args, it will be nil
^^
should be used to run the previous command, so that for people lazy to copy paste when they have to add anything new to the command (example set a env variable then run command)
Using Artix Linux with Linux 5.11.6
$ go build main.go
# command-line-arguments
./main.go:95:38: undefined: hshprompt
$ echo $?
2
Am I missing something?
No matter if Hilbish already has a config in $HOME
, itll overwrite it with the default config
/home/devin/.hilbishrc.lua:2: module lunacolors not found:
no field package.preload['lunacolors']
stat ./lunacolors.lua: no such file or directory
stat /usr/local/share/lua/5.1/lunacolors.lua: no such file or directory
stat /usr/local/share/lua/5.1/lunacolors/init.lua: no such file or directory
stat ./libs/lunacolors/init.lua: no such file or directory
stat ./lunacolors/init.lua: no such file or directory
stat ./lunacolors/lunacolors.lua: no such file or directory
stat /usr/share/hilbish/libs/lunacolors/init.lua: no such file or directory
stat : no such file or directory
stat /usr/share/hilbish/libs/lunacolors/lunacolors.lua: no such file or directory
stat /home/devin/.local/share/hilbish/libs/lunacolors/init.lua: no such file or directory
stat /home/devin/.local/share/hilbish/libs/lunacolors/lunacolors.lua: no such file or directory
stat /home/devin/.local/share/hilbish/libs/lunacolors.lua: no such file or directory,
stack traceback:
[G]: in function 'require'
/home/devin/.hilbishrc.lua:2: in main chunk
[G]: ?
An error has occured while loading your config! Falling back to minimal default config.
currently the most depth of something that can be completed is 3.
in the example of git, git <command> <flag/file>
. users should be able to do more than that configurable via lua function
for hilbish's lua functions written in go and accepting arguments, lua.CheckType
should be used where Type
is the type of the argument
for example:
str := lua.ToString(1)
// should be replaced with
str := lua.CheckString(1)
this will automatically raise a lua error if the arg isn't provided or is the incorrect type, which is why for optional args this should not be changed and should remain lua.ToType
for lua there should be a convenient appendPath
function and as the name suggests, will add the provided directory to the $PATH
basically there's no need to do
os.setenv('PATH', os.getenv 'PATH' .. ':/my/path:/home/' .. os.getenv 'USER' .. '/bin')
instead one can do
appendPath('/my/path', '~/bin')
i think that the readme could have more pizzazz, including some thing like screenshots, badgets and just make it nicer and more attractive
https://keepachangelog.com/en/1.0.0/
a top level changelog.md file to list the changelogs of all versions of hilbish
this prompt is for when the user is doing multiline input
it is currently ..
, but this should be customizable
running tty
in hilbish will say that it's not a tty. this also means that top doesnt work, and htop, other shells and hilbish itself exit immediately when trying to open
ive tried opening a pty and while it has worked (tty
shows the pts device) running hilbish in itself still isnt optimal and top cant be exited from
exactly as the title says, the 2 functions it provides should be available in the hilbish lua api for use. this would be convenient, for example, enhancing the builtin cd
command even more, and other things
a hilbish.aliases
interface which will have functions which relate to aliasing
list()
- #86add(name, command)
- same as the current alias
functiondelete(name)
- removes an aliasi was testing petals, and oh look! a panic
the source is this line here. since petals (formerly, ill fix it there) doesnt return an exit code, it causes that call to panic
a simple fix would be to check if luaexitcode
is nil, and if it is don't try to pop, since nothing has been returned
or the pop can just go in the if call right below it, probably
on every command, we create a new sh runner to execute our sh. this is a little bit inefficient. if a global runner was used,
it would hold old declared env variables, and shell scripts would be able to be sourced
could be useful, acts as the which builtin for shells
having to write then by hand is pretty annoying, and i'd have no idea how to make generated docs for lua or go
would allow a hilbish script to catch certain signals and act on them (like having a clean exit for ctrl+c)
to explain: if someone wants to print a lua variable, theyll obviously have to use the print function. but this is a bit of a hassle.
and if u want to look at a lua table, that gets more complicated.
instead, someone should be able to just type var
here, like os.getenv 'PATH'
and it prints it just like that, and for tables to print it with keys and values in json style
would allow for consumption by lsp
currently all directories visited including duplicates are added to the recentDirs table which makes cdr have duplicate dirs. the dir should not be added if its the most recent
there are no global functions anymore so the check can be removed
hilbish should expand alias and then try to complete; this is a simple fix.
there should be an option for hilbish to act like other login shells where it loads an additional rc file (dont know what this is/will be though)
cd -
should use the $OLDPWD env variable to cd to the old directory
how this should be handled is either:
fs.cd()
should store the old pwd to that env variable, then actually change the directory. then we check in lua if arg == '-'
, and if it is then fs.cd(os.getenv 'OLDPWD')
fs.cd '-'
is usedrelevant files to change are:
in case 1, golibs/fs/fs.go
and preload.lua
in case 2 only ^
taken from #44 (comment),
functions would be part of the fs
module and be named with a l prefix, like lrename
currently, hilbish's built in version of cd
is very primitive, it just accepts a single argument as the entire directory. what would be cool though, is making env variables work
so people can do something like:
cd $NVM_DIR
would cd to the directory for nvm, as an example.
like appendPath but it prepends instead ๐
to explain:
to support more systems/environments (like nixos i guess and termux) we should set certain paths/other things to be normal variables instead of being hardcoded. these can then be changed with the -X
link flag, as shown in the makefile
appendPath
exists, it is a very useful function that simply appends a dir to the $PATH env variable
problem (not really a problem but yknow): it will always append, no matter if it's already in $PATH
so, the function should check if its provided directory is already in the path. if not, append. if it is there, do nothing
more functions and vars to hilbish!!
if anyone wishes to do any amount of these, just say so
the fs.cd
function does not handle the target not being a directory
the $SHLVL variable is a handy one for finding out how deep a person is in shells. it's pretty useful for me, where im constantly switching between unstable and stable hilbish versions. but it doesnt increment the $SHLVL, so itll stay at its default value (3, for me)
Hi, I'm the AUR maintainer for this package. I believe @MCotocel had asked earlier if I could start building this with the Makefile instead of directly invoking go build
, however, the Makefile in question doesn't seem to respect whatever DESTDIR is set to. This is important for Arch Linux, as packages are not allowed to directly install to /usr/bin
without using pacman
.
This is what I get from an unreleased hilbish PKGBUILD, using the latest release:
make: Warning: File 'Makefile' has modification time 5828 s in the future
'hilbish' -> '/usr/bin/hilbish'
install: cannot create regular file '/usr/bin/hilbish': Permission denied
make: *** [Makefile:9: install] Error 1
A failure occurred in package().
Aborting...
And this is what I have in the PKGBUILD:
package() {
cd "$pkgname-$pkgver"
DESTDIR="$pkgdir/" make install
DESTDIR
is set to $pkgdir
, which expands to the package directory. So ideally it should install to $pkgdir/usr/bin/hilbish
the -C
flag should be a runtime flag that will change the path where Hilbish will load the config file from.
i'm proposing to anyone reading this for a multiline
hook.
this hook will be thrown anytime the user goes into multiline mode, and will have a type
argument to say whether its a user continued line (line here \
) or incomplete sh input
In most shells there's a -n
flag for checking syntax, but not executing any of the input the shell gets, e.g. https://media.discordapp.net/attachments/761279800312332328/838790971617312858/unknown.png
Hilbish should also support this, and check all the lua that the user entered (+ maybe the sh input?).
This flag can be used for checking shell scripts for basic syntax errors, without risking to having to run a script.
example: alias("ls", "ls -lh")
this shouldnt be happening :|
doc
is simple: it will serve as in shell documentation for hilbish functions and fields
example:
-> doc commander
commander: Command handler for hilbish
register(cmdname, callback) - Registers a command with the name of `cmdname` which runs the `callback` when exeucuted
deregister(cmdname) - Removes a commander-registered command
could be expanded/look better possibly
the history interface (hilbish.history
) will be the place to view and/or manipulate and interface with the hilbish command history.
size()
: get the size of the historyadd()
: add text to historyclear()
: clears historyall()
: retrieves all the commands in historyget(n)
: gets the n
th command in historyA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.