2
2
kopia lustrzana https://github.com/Hilbis/Hilbish synced 2025-07-04 10:12:03 +00:00

Porównaj commity

..

5 Commity

Autor SHA1 Wiadomość Data
TorchedSammy
23f6986123 chore: add semantic pull requests config 2021-03-31 14:08:34 -04:00
TorchedSammy
2d93f2ce4a chore: update todo 2021-03-31 13:57:20 -04:00
TorchedSammy
b1f2a36639 fix: trim spaces in cd func 2021-03-31 13:46:49 -04:00
TorchedSammy
204d50d73c feat(preload/cd): throw command hooks in cd command and add support for folders with spaces 2021-03-31 13:46:22 -04:00
TorchedSammy
0987899144 fix: throw command.success hook after successfullua input 2021-03-31 12:53:39 -04:00
5 zmienionych plików z 17 dodań i 7 usunięć

1
.github/semantic.yml vendored Normal file
Wyświetl plik

@ -0,0 +1 @@
titleAndCommits: true

Wyświetl plik

@ -7,3 +7,4 @@
- [x] Hooks
- [x] Aliases
- [ ] hlua (hilbish lua) - 100% lua in the hilbish interactive shell, cuz why not
- [ ] Petals (name of plugins)

Wyświetl plik

@ -2,6 +2,7 @@ package fs
import (
"os"
"strings"
"github.com/yuin/gopher-lua"
)
@ -26,7 +27,7 @@ var exports = map[string]lua.LGFunction{
func cd(L *lua.LState) int {
path := L.ToString(1)
err := os.Chdir(path)
err := os.Chdir(strings.TrimSpace(path))
if err != nil {
switch err.(*os.PathError).Err.Error() {
case "no such file or directory":

Wyświetl plik

@ -108,6 +108,7 @@ func main() {
if err == nil {
// If it succeeds, add to history and prompt again
readline.AddHistory(cmdString)
bait.Em.Emit("command.success", nil)
continue
}

Wyświetl plik

@ -5,17 +5,23 @@ local fs = require 'fs'
local commander = require 'commander'
local bait = require 'bait'
commander.register('cd', function (path)
if #path == 1 then
local ok, err = pcall(function() fs.cd(path[1]) end)
commander.register('cd', function (args)
bait.throw('cd', args)
if #args > 0 then
local path = ''
for i = 1, #args do
path = path .. tostring(args[i]) .. ' '
end
local ok, err = pcall(function() fs.cd(path) end)
if not ok then
if err == 1 then
print('directory does not exist')
end
end
bait.throw('cd', path)
bait.throw('command.fail', nil)
else bait.throw('command.success', nil) end
return
end
fs.cd(os.getenv 'HOME')
bait.throw('cd', path)
bait.throw('command.success', nil)
end)