mirror of https://github.com/Hilbis/Hilbish
Compare commits
No commits in common. "72d6b0a4a0266eb1b3ab1b6c17ea90a3020cc152" and "97188e73a515fa43d36b0bde6c96f7d27438751b" have entirely different histories.
72d6b0a4a0
...
97188e73a5
|
@ -1,11 +1,5 @@
|
|||
# 🎀 Changelog
|
||||
|
||||
## [2.0.1] - 2022-12-28
|
||||
### Fixed
|
||||
- Corrected documentation for hooks, removing outdated `command.no-perm`
|
||||
- Fixed an issue where `cd` with no args would not update the old pwd
|
||||
- Tiny documentation enhancements for the `hilbish.timer` interface
|
||||
|
||||
## [2.0.0] - 2022-12-20
|
||||
**NOTES FOR USERS/PACKAGERS UPDATING:**
|
||||
- Hilbish now uses [Task] insead of Make for builds.
|
||||
|
@ -617,7 +611,6 @@ This input for example will prompt for more input to complete:
|
|||
|
||||
First "stable" release of Hilbish.
|
||||
|
||||
[2.0.1]: https://github.com/Rosettea/Hilbish/compare/v2.0.0...v2.0.1
|
||||
[2.0.0]: https://github.com/Rosettea/Hilbish/compare/v1.2.0...v2.0.0
|
||||
[2.0.0-rc1]: https://github.com/Rosettea/Hilbish/compare/v1.2.0...v2.0.0-rc1
|
||||
[1.2.0]: https://github.com/Rosettea/Hilbish/compare/v1.1.4...v1.2.0
|
||||
|
|
38
README.md
38
README.md
|
@ -26,30 +26,52 @@ and aims to be infinitely configurable. If something isn't, open an issue!
|
|||
|
||||
# Table of Contents
|
||||
- [Screenshots](#Screenshots)
|
||||
- [Getting Hilbish](#Getting-Hilbish)
|
||||
- [Installation](#Installation)
|
||||
- [Prebuilt Bins](#Prebuilt-binaries)
|
||||
- [AUR](#AUR)
|
||||
- [Nixpkgs](#Nixpkgs)
|
||||
- [Manual Build](#Manual-Build)
|
||||
- [Contributing](#Contributing)
|
||||
|
||||
# Screenshots
|
||||
<div align="center">
|
||||
<img src="gallery/default.png"><br><br>
|
||||
<img src="gallery/terminal.png"><br><br>
|
||||
<img src="gallery/tab.png"><br><br>
|
||||
<img src="gallery/pillprompt.png">
|
||||
</div>
|
||||
|
||||
# Getting Hilbish
|
||||
# Installation
|
||||
**NOTE:** Hilbish is not guaranteed to work properly on Windows, starting
|
||||
from the 2.0 version. It will still be able to compile, but functionality
|
||||
may be lacking.
|
||||
|
||||
You can check the [install page](https://rosettea.github.io/Hilbish/install/)
|
||||
on the website for distributed binaries from GitHub or other package repositories.
|
||||
Otherwise, continue reading for steps on compiling.
|
||||
## Prebuilt binaries
|
||||
Go [here](https://nightly.link/Rosettea/Hilbish/workflows/build/master) for
|
||||
builds on the master branch.
|
||||
|
||||
## Prerequisites
|
||||
## AUR
|
||||
[![AUR maintainer](https://img.shields.io/aur/maintainer/hilbish?logo=arch-linux&style=flat-square)](https://aur.archlinux.org/packages/hilbish)
|
||||
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
|
||||
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
|
||||
- [Go 1.17+](https://go.dev)
|
||||
- [Task](https://taskfile.dev/installation/) (**Go on the hyperlink here to see Task's install method for your OS.**)
|
||||
|
||||
## Build
|
||||
### Build
|
||||
First, clone Hilbish. The recursive is required, as some Lua libraries
|
||||
are submodules.
|
||||
```sh
|
||||
|
|
|
@ -8,28 +8,9 @@ menu:
|
|||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
If you ever want to run a piece of code on a timed interval, or want to wait
|
||||
a few seconds, you don't have to rely on timing tricks, as Hilbish has a
|
||||
timer API to set intervals and timeouts.
|
||||
|
||||
These are the simple functions `hilbish.interval` and `hilbish.timeout` (doc
|
||||
accessible with `doc hilbish`). But if you want slightly more control over
|
||||
them, there is the `hilbish.timers` interface. It allows you to get
|
||||
a timer via ID and control them.
|
||||
|
||||
All functions documented with the `Timer` type refer to a Timer object.
|
||||
|
||||
An example of usage:
|
||||
```
|
||||
local t = hilbish.timers.create(1, 5000, function()
|
||||
print 'hello!'
|
||||
end)
|
||||
|
||||
t:stop()
|
||||
print(t.running, t.duration, t.type)
|
||||
t:start()
|
||||
```
|
||||
The timers interface si one to easily set timeouts and intervals
|
||||
to run functions after a certain time or repeatedly without using
|
||||
odd tricks.
|
||||
|
||||
## Interface fields
|
||||
- `INTERVAL`: Constant for an interval timer type
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
|
||||
+ `command.not-found` -> cmdStr > Thrown when a command is not found.
|
||||
|
||||
+ `command.not-executable` -> cmdStr > Thrown when Hilbish attempts to run a file
|
||||
that is not executable.
|
||||
+ `command.no-perm` -> cmdStr > Thrown when Hilbish attempts to execute a file but
|
||||
has no permission.
|
||||
|
|
|
@ -1 +1,38 @@
|
|||
This has been moved to the `hilbish.timers` API doc (accessible by `doc api hilbish.timers`)
|
||||
If you ever want to run a piece of code on a timed interval, or want to wait
|
||||
a few seconds, you don't have to rely on timing tricks, as Hilbish has a
|
||||
timer API to set intervals and timeouts.
|
||||
|
||||
These are the simple functions `hilbish.interval` and `hilbish.timeout` (doc
|
||||
accessible with `doc hilbish`). But if you want slightly more control over
|
||||
them, there is the `hilbish.timers` interface. It allows you to get
|
||||
a timer via ID.
|
||||
|
||||
# Timer Interface
|
||||
## Functions
|
||||
- `get(id)` -> timer: get a timer via its id
|
||||
- `create(type, ms, callback)` -> timer: creates a timer, adding it to the timer pool.
|
||||
`type` is the type of timer it will be. 0 is an interval, 1 is a timeout.
|
||||
`ms` is the time it will run for in seconds. callback is the function called
|
||||
when the timer is triggered.
|
||||
|
||||
# Timer Object
|
||||
All those previously mentioned functions return a `timer` object, to which
|
||||
you can stop and start a timer again.
|
||||
|
||||
An example of usage:
|
||||
local t = hilbish.timers.create(1, 5000, function()
|
||||
print 'hello!'
|
||||
end)
|
||||
|
||||
t:stop()
|
||||
print(t.running, t.duration, t.type)
|
||||
t:start()
|
||||
|
||||
## Properties
|
||||
- `duration`: amount of time the timer runs for in milliseconds
|
||||
- `running`: whether the timer is running or not
|
||||
- `type`: the type of timer (0 is interval, 1 is timeout)
|
||||
|
||||
## Functions
|
||||
- `stop()`: stops the timer. returns an error if it's already stopped
|
||||
- `start()`: starts the timer. returns an error if it's already started
|
||||
|
|
BIN
gallery/tab.png
BIN
gallery/tab.png
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
|
@ -8,21 +8,28 @@ commander.register('cd', function (args)
|
|||
if #args > 1 then
|
||||
print("cd: too many arguments")
|
||||
return 1
|
||||
end
|
||||
elseif #args > 0 then
|
||||
local path = args[1]:gsub('$%$','\0'):gsub('${([%w_]+)}', os.getenv)
|
||||
:gsub('$([%w_]+)', os.getenv):gsub('%z','$'):gsub('^%s*(.-)%s*$', '%1')
|
||||
|
||||
local path = args[1] and args[1] or hilbish.home
|
||||
if path == '-' then
|
||||
path = dirs.old
|
||||
print(path)
|
||||
end
|
||||
if path == '-' then
|
||||
path = dirs.old
|
||||
print(path)
|
||||
end
|
||||
dirs.setOld(hilbish.cwd())
|
||||
dirs.push(path)
|
||||
|
||||
dirs.setOld(hilbish.cwd())
|
||||
dirs.push(path)
|
||||
local ok, err = pcall(function() fs.cd(path) end)
|
||||
if not ok then
|
||||
print(err)
|
||||
return 1
|
||||
end
|
||||
bait.throw('cd', path)
|
||||
|
||||
local ok, err = pcall(function() fs.cd(path) end)
|
||||
if not ok then
|
||||
print(err)
|
||||
return 1
|
||||
return
|
||||
end
|
||||
bait.throw('cd', path)
|
||||
fs.cd(hilbish.home)
|
||||
bait.throw('cd', hilbish.home)
|
||||
|
||||
dirs.push(hilbish.home)
|
||||
end)
|
||||
|
|
|
@ -119,30 +119,9 @@ func (th *timersModule) luaGet(thr *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
|||
// #property running If the timer is running
|
||||
// #property duration The duration in milliseconds that the timer will run
|
||||
// timeout and interval API
|
||||
/*
|
||||
If you ever want to run a piece of code on a timed interval, or want to wait
|
||||
a few seconds, you don't have to rely on timing tricks, as Hilbish has a
|
||||
timer API to set intervals and timeouts.
|
||||
|
||||
These are the simple functions `hilbish.interval` and `hilbish.timeout` (doc
|
||||
accessible with `doc hilbish`). But if you want slightly more control over
|
||||
them, there is the `hilbish.timers` interface. It allows you to get
|
||||
a timer via ID and control them.
|
||||
|
||||
## Timer Object
|
||||
All functions documented with the `Timer` type refer to a Timer object.
|
||||
|
||||
An example of usage:
|
||||
```
|
||||
local t = hilbish.timers.create(1, 5000, function()
|
||||
print 'hello!'
|
||||
end)
|
||||
|
||||
t:stop()
|
||||
print(t.running, t.duration, t.type)
|
||||
t:start()
|
||||
```
|
||||
*/
|
||||
// The timers interface si one to easily set timeouts and intervals
|
||||
// to run functions after a certain time or repeatedly without using
|
||||
// odd tricks.
|
||||
func (th *timersModule) loader(rtm *rt.Runtime) *rt.Table {
|
||||
timerMethods := rt.NewTable()
|
||||
timerFuncs := map[string]util.LuaExport{
|
||||
|
|
Loading…
Reference in New Issue