Compare commits

...

5 Commits

Author SHA1 Message Date
sammyette 7ac0e27739
fix: lib paths for ~/.config 2021-10-13 11:27:37 -04:00
sammyette d2c720c863
fix: make lib paths in ~/.config/hilbish on linux 2021-10-13 10:50:38 -04:00
sammyette 0977110e79
feat: add default history dir to xdg dir, or fallback to home 2021-10-13 10:42:35 -04:00
sammyette b387b18923
fix: properly default config dir to xdg dir 2021-10-13 10:41:55 -04:00
sammyette d58617b173
docs: slight refactor of the readme 2021-10-12 16:01:17 -04:00
9 changed files with 59 additions and 55 deletions

View File

@ -1,17 +1,23 @@
<div align="center"> <div align="center">
<h1>Hilbish</h1> <img src="./assets/hilbish-flower.png" width=128><br>
<img src="./assets/hilbish-text.png" width=256>
<h1></h1>
<blockquote> <blockquote>
🎀 a nice lil shell for lua people made with go and lua 🌺 The flower shell. A comfy and nice little shell for Lua users and fans!
</blockquote><p align="center"> </blockquote>
<a href="https://github.com/Hilbis/Hilbish/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22"><img src="https://img.shields.io/github/issues/Hilbis/Hilbish/help%20wanted?color=green" alt="help wanted"></a> <p align="center">
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg"></a> <img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/Rosettea/Hilbish?style=flat-square">
<img alt="GitHub commits since latest release (by date)" src="https://img.shields.io/github/commits-since/Rosettea/Hilbish/latest?style=flat-square">
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/Rosettea/Hilbish?style=flat-square"><br>
<a href="https://github.com/Rosettea/Hilbish/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22"><img src="https://img.shields.io/github/issues/Hilbis/Hilbish/help%20wanted?style=flat-square&color=green" alt="help wanted"></a>
<a href="https://github.com/Rosettea/Hilbish/blob/master/LICENSE"><img alt="GitHub license" src="https://img.shields.io/github/license/Rosettea/Hilbish?style=flat-square"></a>
<a href="https://discord.gg/3PDdcQz"><img alt="Discord" src="https://img.shields.io/discord/732357621503229962?color=blue&style=flat-square"></a>
</p> </p>
</div> </div>
Hilbish is an interactive Unix-like shell written in Go, with the config Hilbish is a new, Unix-like shell which uses Lua as its configuration language.
and other code written in Lua. It's decently fast for interactive use and includes a bunch of utility functions and features
It is sort of in a stable state currently, usable as a daily shell, to make your life in a terminal easier.
but there may still be breaking changes in Lua modules.
# Screenshots # Screenshots
<div align="center"> <div align="center">
@ -42,21 +48,22 @@ like what is highlighted in the screenshot.
<br><img src="https://modeus.is-inside.me/KJ0Puceb.png"><br> <br><img src="https://modeus.is-inside.me/KJ0Puceb.png"><br>
### AUR ### AUR
Arch Linux users can install Hilbish from the AUR. ![AUR maintainer](https://img.shields.io/aur/maintainer/hilbish?logo=arch-linux&style=flat-square)
Arch Linux users can install Hilbish from the AUR with the following command:
```sh ```sh
yay -S hilbish yay -S hilbish
``` ```
If you want the latest and greatest, you can install and compile from the latest git commit Or from the latest `master` commit with:
```sh ```sh
yay -S hilbish-git yay -S hilbish-git
``` ```
### Manual Build ### Manual Build
#### Prerequisites #### Prerequisites
- [Go 1.16](https://go.dev) - [Go 1.16+](https://go.dev)
- GNU Readline - GNU Readline
On Fedora, readline can be installed with: On Fedora or other RPM based distros, readline can be installed with:
``` ```
sudo dnf install readline-devel sudo dnf install readline-devel
``` ```
@ -66,11 +73,6 @@ On Debian/Ubuntu and distros based on them, it can be installed with:
sudo apt install libreadline-dev sudo apt install libreadline-dev
``` ```
On OpenSUSE, it can be installed with:
```
sudo zypper install readline-devel
```
On Arch Linux, it can be installed with: On Arch Linux, it can be installed with:
``` ```
sudo pacman -S readline sudo pacman -S readline
@ -79,48 +81,38 @@ sudo pacman -S readline
#### Build #### Build
First, clone Hilbish: First, clone Hilbish:
```sh ```sh
git clone --recursive https://github.com/Hilbis/Hilbish git clone --recursive https://github.com/Rosettea/Hilbish
cd Hilbish cd Hilbish
# If you want the latest stable release, run this following command go get -d ./...
git checkout $(git describe --tags `git rev-list --tags --max-count=1`) ```
```
And get dependencies and build: To build, run:
```sh ```
go get -d all
make dev make dev
```
Or, if you want a stable branch, run these commands:
``` ```
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
make build
```
If you `git checkout`'d the latest stable release, run After you did all that, run `sudo make install` to install Hilbish globally.
`make build` instead of `make dev`.
or want to experiment Hilbiline, instead run
`make hilbiline`
#### Install
`sudo make install`
### Uninstall
```sh
sudo make uninstall
```
# Contributing # Contributing
Any kind of contributions to Hilbish are welcome! Any kind of contributions to Hilbish are welcome!
Make sure to read [CONTRIBUTING.md](CONTRIBUTING.md) before getting started. Read [CONTRIBUTING.md](CONTRIBUTING.md) before getting started.
### Special Thanks To
Everyone here who has contributed:
##### Thanks to everyone below who's contributed!
<a href="https://github.com/Hilbis/Hilbish/graphs/contributors"> <a href="https://github.com/Hilbis/Hilbish/graphs/contributors">
<img src="https://contrib.rocks/image?repo=Hilbis/Hilbish" /> <img src="https://contrib.rocks/image?repo=Hilbis/Hilbish" />
</a> </a>
*Made with [contributors-img](https://contrib.rocks).* *Made with [contributors-img](https://contrib.rocks).*
### Credits
- [This blog post](https://www.vidarholen.net/contents/blog/?p=878) which
is how Hilbish now inserts a newline even if output doesn't have one.
# License # License
Hilbish is licensed under the MIT license. Hilbish is licensed under the MIT license!
[Read here](LICENSE) for more info. Read the [license here](LICENSE) for more info.
Images in the [assets](assets/) folder are under CC-BY-SA 4.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 114 KiB

15
main.go
View File

@ -32,6 +32,7 @@ var (
hooks bait.Bait hooks bait.Bait
defaultConfPath string defaultConfPath string
defaultHistPath string
) )
func main() { func main() {
@ -43,7 +44,7 @@ func main() {
if defaultConfDir == "" { if defaultConfDir == "" {
// we'll add *our* default if its empty (wont be if its changed comptime) // we'll add *our* default if its empty (wont be if its changed comptime)
if _, err := os.Stat(filepath.Join(confDir, "hilbish", "hilbishrc.lua")); os.IsNotExist(err) { if _, err := os.Stat(filepath.Join(confDir, "hilbish")); os.IsNotExist(err) {
defaultConfPath = filepath.Join(homedir, "/.hilbishrc.lua") defaultConfPath = filepath.Join(homedir, "/.hilbishrc.lua")
} else { } else {
defaultConfPath = filepath.Join(confDir, "hilbish", "hilbishrc.lua") defaultConfPath = filepath.Join(confDir, "hilbish", "hilbishrc.lua")
@ -52,7 +53,17 @@ func main() {
// else do ~ substitution // else do ~ substitution
defaultConfPath = filepath.Join(strings.Replace(defaultConfDir, "~", homedir, 1), ".hilbishrc.lua") defaultConfPath = filepath.Join(strings.Replace(defaultConfDir, "~", homedir, 1), ".hilbishrc.lua")
} }
if defaultHistDir == "" {
// we'll add *our* default if its empty (wont be if its changed comptime)
if _, err := os.Stat(filepath.Join(confDir, "hilbish")); os.IsNotExist(err) {
defaultHistPath = filepath.Join(homedir, "/.hilbish-history")
} else {
defaultHistPath = filepath.Join(confDir, "hilbish", ".hilbish-history")
}
} else {
// else do ~ substitution
defaultHistPath = filepath.Join(strings.Replace(defaultHistDir, "~", homedir, 1), ".hilbishrc.lua")
}
helpflag := getopt.BoolLong("help", 'h', "Prints Hilbish flags") helpflag := getopt.BoolLong("help", 'h', "Prints Hilbish flags")
verflag := getopt.BoolLong("version", 'v', "Prints Hilbish version") verflag := getopt.BoolLong("version", 'v', "Prints Hilbish version")
setshflag := getopt.BoolLong("setshellenv", 'S', "Sets $SHELL to Hilbish's executed path") setshflag := getopt.BoolLong("setshellenv", 'S', "Sets $SHELL to Hilbish's executed path")

4
rl.go
View File

@ -14,7 +14,7 @@ type LineReader struct {
// other gophers might hate this naming but this is local, shut up // other gophers might hate this naming but this is local, shut up
func NewLineReader(prompt string) *LineReader { func NewLineReader(prompt string) *LineReader {
readline.Completer = readline.FilenameCompleter readline.Completer = readline.FilenameCompleter
readline.LoadHistory(homedir + "/.hilbish-history") readline.LoadHistory(defaultHistPath)
return &LineReader{ return &LineReader{
Prompt: prompt, Prompt: prompt,
@ -31,7 +31,7 @@ func (lr *LineReader) SetPrompt(prompt string) {
func (lr *LineReader) AddHistory(cmd string) { func (lr *LineReader) AddHistory(cmd string) {
readline.AddHistory(cmd) readline.AddHistory(cmd)
readline.SaveHistory(homedir + "/.hilbish-history") readline.SaveHistory(defaultHistPath)
} }
func (lr *LineReader) ClearInput() { func (lr *LineReader) ClearInput() {

View File

@ -4,6 +4,7 @@ package main
var ( var (
version = "v0.5.1" version = "v0.5.1"
defaultConfDir = "" // ~ will be substituted for home, path for user's default config defaultConfDir = "" // ~ will be substituted for home, path for user's default config
defaultHistDir = ""
prompt string // Prompt will always get changed anyway prompt string // Prompt will always get changed anyway
multilinePrompt = "> " multilinePrompt = "> "

View File

@ -10,9 +10,9 @@ var (
.. hilbish.xdg.data .. '/hilbish/libs/?/init.lua;' .. hilbish.xdg.data .. '/hilbish/libs/?/init.lua;'
.. hilbish.xdg.data .. '/hilbish/libs/?/?.lua;' .. hilbish.xdg.data .. '/hilbish/libs/?/?.lua;'
.. hilbish.xdg.data .. '/hilbish/libs/?.lua' .. hilbish.xdg.data .. '/hilbish/libs/?.lua'
.. hilbish.xdg.config .. '/?/init.lua' .. hilbish.xdg.config .. '/hilbish/?/init.lua'
.. hilbish.xdg.config .. '/?/?.lua' .. hilbish.xdg.config .. '/hilbish/?/?.lua'
.. hilbish.xdg.config .. '/?.lua'` .. hilbish.xdg.config .. '/hilbish/?.lua'`
preloadPath = "/usr/share/hilbish/preload.lua" preloadPath = "/usr/share/hilbish/preload.lua"
sampleConfPath = "/usr/share/hilbish/.hilbishrc.lua" // Path to default/sample config sampleConfPath = "/usr/share/hilbish/.hilbishrc.lua" // Path to default/sample config
) )