Compare commits

..

No commits in common. "54689b7dd1f04d7048496fcc81cec779b00788d2" and "f81babe9737de4dd6fcf6ba55fbb8746deddbd04" have entirely different histories.

2 changed files with 7 additions and 20 deletions

View File

@ -31,7 +31,7 @@ it to be.
# Installation
**NOTE:** Hilbish is currently only officially supported and tested on Linux
## Prebuilt binaries
### Prebuilt binaries
Binaries are provided for the latest commit.
**Note that these use Hilbiline, not readline, and may be missing functionality
@ -44,25 +44,24 @@ Then click on the artifacts drop down, and download artifact for your platform,
like what is highlighted in the screenshot.
<br><img src="https://modeus.is-inside.me/KJ0Puceb.png"><br>
## AUR
[![AUR maintainer](https://img.shields.io/aur/maintainer/hilbish?logo=arch-linux&style=flat-square)](https://aur.archlinux.org/packages/hilbish)
### 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
yay -S hilbish
```
[![AUR maintainer](https://img.shields.io/aur/maintainer/hilbish?logo=arch-linux&style=flat-square)](https://aur.archlinux.org/packages/hilbish-git)
Or from the latest `master` commit with:
```sh
yay -S hilbish-git
```
## Nixpkgs
### Nixpkgs
Nix/NixOS users can install Hilbish from the central repository, nixpkgs, through the usual ways.
If you're new to nix you should probably read up on how to do that [here](https://nixos.wiki/wiki/Cheatsheet).
## Manual Build
### Prerequisites
### Manual Build
#### Prerequisites
- [Go 1.16+](https://go.dev)
- GNU Readline

View File

@ -2,7 +2,6 @@ package main
import (
"strings"
"sync"
"github.com/yuin/gopher-lua"
)
@ -11,21 +10,16 @@ var aliases *hilbishAliases
type hilbishAliases struct {
aliases map[string]string
mu *sync.RWMutex
}
// initialize aliases map
func NewAliases() *hilbishAliases {
return &hilbishAliases{
aliases: make(map[string]string),
mu: &sync.RWMutex{},
}
}
func (h *hilbishAliases) Add(alias, cmd string) {
h.mu.Lock()
defer h.mu.Unlock()
h.aliases[alias] = cmd
}
@ -34,16 +28,10 @@ func (h *hilbishAliases) All() map[string]string {
}
func (h *hilbishAliases) Delete(alias string) {
h.mu.Lock()
defer h.mu.Unlock()
delete(h.aliases, alias)
}
func (h *hilbishAliases) Resolve(cmdstr string) string {
h.mu.RLock()
defer h.mu.RUnlock()
args := strings.Split(cmdstr, " ")
for h.aliases[args[0]] != "" {
alias := h.aliases[args[0]]