mirror of https://github.com/Hilbis/Hilbish
Compare commits
1 Commits
4a9fc7c117
...
16b875a4a7
Author | SHA1 | Date |
---|---|---|
sammyette | 16b875a4a7 |
32
api.go
32
api.go
|
@ -336,19 +336,9 @@ func hlmultiprompt(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// alias(cmd, orig)
|
// alias(cmd, orig)
|
||||||
// Sets an alias, with a name of `cmd` to another command.
|
// Sets an alias of `cmd` to `orig`
|
||||||
// #param cmd string Name of the alias
|
// --- @param cmd string
|
||||||
// #param orig string Command that will be aliased
|
// --- @param orig string
|
||||||
/*
|
|
||||||
#example
|
|
||||||
-- With this, "ga file" will turn into "git add file"
|
|
||||||
hilbish.alias('ga', 'git add')
|
|
||||||
|
|
||||||
-- Numbered substitutions are supported here!
|
|
||||||
hilbish.alias('dircount', 'ls %1 | wc -l')
|
|
||||||
-- "dircount ~" would count how many files are in ~ (home directory).
|
|
||||||
#example
|
|
||||||
*/
|
|
||||||
func hlalias(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
func hlalias(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
||||||
if err := c.CheckNArgs(2); err != nil {
|
if err := c.CheckNArgs(2); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -368,20 +358,8 @@ func hlalias(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// appendPath(dir)
|
// appendPath(dir)
|
||||||
// Appends the provided dir to the command path (`$PATH`)
|
// Appends `dir` to $PATH
|
||||||
// #param dir string|table Directory (or directories) to append to path
|
// --- @param dir string|table
|
||||||
/*
|
|
||||||
#example
|
|
||||||
hilbish.appendPath '~/go/bin'
|
|
||||||
-- Will add ~/go/bin to the command path.
|
|
||||||
|
|
||||||
-- Or do multiple:
|
|
||||||
hilbush.appendPath {
|
|
||||||
'~/go/bin',
|
|
||||||
'~/.local/bin'
|
|
||||||
}
|
|
||||||
#example
|
|
||||||
*/
|
|
||||||
func hlappendPath(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
func hlappendPath(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
||||||
if err := c.Check1Arg(); err != nil {
|
if err := c.Check1Arg(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
title: API
|
title: API
|
||||||
layout: doc
|
layout: doc
|
||||||
weight: -100
|
weight: -50
|
||||||
menu: docs
|
menu: docs
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ interfaces and functions which directly relate to shell functionality.
|
||||||
## Functions
|
## Functions
|
||||||
|||
|
|||
|
||||||
|----|----|
|
|----|----|
|
||||||
|<a href="#alias">alias(cmd, orig)</a>|Sets an alias, with a name of `cmd` to another command.|
|
|<a href="#alias">alias(cmd, orig)</a>|Sets an alias of `cmd` to `orig`|
|
||||||
|<a href="#appendPath">appendPath(dir)</a>|Appends the provided dir to the command path (`$PATH`)|
|
|<a href="#appendPath">appendPath(dir)</a>|Appends `dir` to $PATH|
|
||||||
|<a href="#complete">complete(scope, cb)</a>|Registers a completion handler for `scope`.|
|
|<a href="#complete">complete(scope, cb)</a>|Registers a completion handler for `scope`.|
|
||||||
|<a href="#cwd">cwd() -> string</a>|Returns the current directory of the shell|
|
|<a href="#cwd">cwd() -> string</a>|Returns the current directory of the shell|
|
||||||
|<a href="#exec">exec(cmd)</a>|Replaces running hilbish with `cmd`|
|
|<a href="#exec">exec(cmd)</a>|Replaces running hilbish with `cmd`|
|
||||||
|
@ -54,25 +54,9 @@ hilbish.alias(cmd, orig)
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
Sets an alias, with a name of `cmd` to another command.
|
Sets an alias of `cmd` to `orig`
|
||||||
|
|
||||||
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
`string` **`cmd`**
|
This function has no parameters.
|
||||||
Name of the alias
|
|
||||||
|
|
||||||
`string` **`orig`**
|
|
||||||
Command that will be aliased
|
|
||||||
|
|
||||||
#### Example
|
|
||||||
```lua
|
|
||||||
-- With this, "ga file" will turn into "git add file"
|
|
||||||
hilbish.alias('ga', 'git add')
|
|
||||||
|
|
||||||
-- Numbered substitutions are supported here!
|
|
||||||
hilbish.alias('dircount', 'ls %1 | wc -l')
|
|
||||||
-- "dircount ~" would count how many files are in ~ (home directory).
|
|
||||||
````
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='appendPath'>
|
<hr><div id='appendPath'>
|
||||||
|
@ -83,24 +67,9 @@ hilbish.appendPath(dir)
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
Appends the provided dir to the command path (`$PATH`)
|
Appends `dir` to $PATH
|
||||||
|
|
||||||
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
`string|table` **`dir`**
|
This function has no parameters.
|
||||||
Directory (or directories) to append to path
|
|
||||||
|
|
||||||
#### Example
|
|
||||||
```lua
|
|
||||||
hilbish.appendPath '~/go/bin'
|
|
||||||
-- Will add ~/go/bin to the command path.
|
|
||||||
|
|
||||||
-- Or do multiple:
|
|
||||||
hilbush.appendPath {
|
|
||||||
'~/go/bin',
|
|
||||||
'~/.local/bin'
|
|
||||||
}
|
|
||||||
````
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='complete'>
|
<hr><div id='complete'>
|
||||||
|
|
|
@ -1,12 +1,3 @@
|
||||||
---
|
|
||||||
title: Completions
|
|
||||||
description: Tab completion for commands.
|
|
||||||
layout: doc
|
|
||||||
menu:
|
|
||||||
docs:
|
|
||||||
parent: "Features"
|
|
||||||
---
|
|
||||||
|
|
||||||
Hilbish has a pretty good completion system. It has a nice looking
|
Hilbish has a pretty good completion system. It has a nice looking
|
||||||
menu, with 2 types of menus: grid (like file completions) or
|
menu, with 2 types of menus: grid (like file completions) or
|
||||||
list.
|
list.
|
||||||
|
|
|
@ -1,12 +1,3 @@
|
||||||
---
|
|
||||||
title: Jobs
|
|
||||||
description: Controls for background commands in Hilbish.
|
|
||||||
layout: doc
|
|
||||||
menu:
|
|
||||||
docs:
|
|
||||||
parent: "Features"
|
|
||||||
---
|
|
||||||
|
|
||||||
Hilbish has pretty standard job control. It's missing one or two things,
|
Hilbish has pretty standard job control. It's missing one or two things,
|
||||||
but works well. One thing which is different from other shells
|
but works well. One thing which is different from other shells
|
||||||
(besides Hilbish) itself is the API for jobs, and of course it's in Lua.
|
(besides Hilbish) itself is the API for jobs, and of course it's in Lua.
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
---
|
|
||||||
title: Lunacolors
|
|
||||||
layout: doc
|
|
||||||
weight: -60
|
|
||||||
menu: docs
|
|
||||||
---
|
|
||||||
|
|
||||||
Lunacolors is an ANSI color/styling library for Lua. It is included
|
Lunacolors is an ANSI color/styling library for Lua. It is included
|
||||||
by default in standard Hilbish distributions to provide easy styling
|
by default in standard Hilbish distributions to provide easy styling
|
||||||
for things like prompts and text.
|
for things like prompts and text.
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
---
|
|
||||||
title: Nature
|
|
||||||
layout: doc
|
|
||||||
weight: -90
|
|
||||||
menu: docs
|
|
||||||
---
|
|
||||||
|
|
||||||
A bit after creation, we have the outside nature. Little plants, seeds,
|
A bit after creation, we have the outside nature. Little plants, seeds,
|
||||||
growing to their final phase: a full plant. A lot of Hilbish itself is
|
growing to their final phase: a full plant. A lot of Hilbish itself is
|
||||||
written in Go, but there are parts made in Lua, being most builtins
|
written in Go, but there are parts made in Lua, being most builtins
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
---
|
|
||||||
title: Vim Mode
|
|
||||||
layout: doc
|
|
||||||
weight: -90
|
|
||||||
menu: docs
|
|
||||||
---
|
|
||||||
|
|
||||||
Hilbish has a Vim binding input mode accessible for use.
|
Hilbish has a Vim binding input mode accessible for use.
|
||||||
It can be enabled with the `hilbish.inputMode` function (check `doc hilbish`).
|
It can be enabled with the `hilbish.inputMode` function (check `doc hilbish`).
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,3 @@
|
||||||
---
|
|
||||||
title: Actions
|
|
||||||
layout: doc
|
|
||||||
weight: -80
|
|
||||||
menu:
|
|
||||||
docs:
|
|
||||||
parent: "Vim Mode"
|
|
||||||
---
|
|
||||||
|
|
||||||
Vim actions are essentially just when a user uses a Vim keybind.
|
Vim actions are essentially just when a user uses a Vim keybind.
|
||||||
Things like yanking and pasting are Vim actions.
|
Things like yanking and pasting are Vim actions.
|
||||||
This is not an "offical Vim thing," just a Hilbish thing.
|
This is not an "offical Vim thing," just a Hilbish thing.
|
||||||
|
|
|
@ -49,14 +49,13 @@ function hilbish.editor.getChar() end
|
||||||
--- @param text string
|
--- @param text string
|
||||||
function hilbish.editor.setVimRegister(register, text) end
|
function hilbish.editor.setVimRegister(register, text) end
|
||||||
|
|
||||||
--- Sets an alias, with a name of `cmd` to another command.
|
--- Sets an alias of `cmd` to `orig`
|
||||||
---
|
--- @param cmd string
|
||||||
---
|
--- @param orig string
|
||||||
function hilbish.alias(cmd, orig) end
|
function hilbish.alias(cmd, orig) end
|
||||||
|
|
||||||
--- Appends the provided dir to the command path (`$PATH`)
|
--- Appends `dir` to $PATH
|
||||||
---
|
--- @param dir string|table
|
||||||
---
|
|
||||||
function hilbish.appendPath(dir) end
|
function hilbish.appendPath(dir) end
|
||||||
|
|
||||||
--- Registers a completion handler for `scope`.
|
--- Registers a completion handler for `scope`.
|
||||||
|
|
Loading…
Reference in New Issue