Some fixes

pull/583/head
Arijit Basu 1 year ago
parent 77b99ae413
commit 28af947ee8

@ -131,7 +131,7 @@ xplr.util.node("/")
Get the configured [Node Type][6] of a given [Node][5].
Type: function( [Node][5], [NodeTypesConfig][7]|nil ) -> [NodeType][5]
Type: function( [Node][5], [xplr.config.node_types][7]|nil ) -> [NodeType][5]
If the second argument is missing, global config `xplr.config.node_types`
will be used.
@ -140,10 +140,10 @@ Example:
```lua
xplr.util.node_type(app.focused_node)
-- { style = { fg = ..., ... }, meta = { icon = ..., ... } ... }
-- { style = { fg = "Red", ... }, meta = { icon = "", ... } ... }
xplr.util.node_type(xplr.util.node("/foo/bar"), xplr.config.node_types)
-- { style = { fg = ..., ... }, meta = { icon = ..., ... } ... }
-- { style = { fg = "Red", ... }, meta = { icon = "", ... } ... }
```
### xplr.util.dirname
@ -191,9 +191,9 @@ xplr.util.absolute("foo/bar")
Get the relative path based on the given base path or current working dir.
Will error if it fails to determine a relative path.
Type: function( path:string, config:Config|nil ) -> path:string
Type: function( path:string, options:table|nil ) -> path:string
Config type: { base:string|nil, with_prefix_dots:bookean|nil, without_suffix_dots:boolean|nil }
Options type: { base:string|nil, with_prefix_dots:bookean|nil, without_suffix_dots:boolean|nil }
- If `base` path is given, the path will be relative to it.
- If `with_prefix_dots` is true, the path will always start with dots `..` / `.`
@ -406,12 +406,12 @@ xplr.util.paint("Desktop", { fg = "Red", bg = nil, add_modifiers = {}, sub_modif
Mix multiple [Style][3] objects into one.
Type: function( [Style][3], [Style][3], ... ) -> Style[3]
Type: function( { [Style][3], [Style][3], ... } ) -> Style[3]
Example:
```lua
xplr.util.style_mix({ fg = "Red" }, { bg = "Blue" }, { add_modifiers = {"Bold"} })
xplr.util.style_mix({{ fg = "Red" }, { bg = "Blue" }, { add_modifiers = {"Bold"} }})
-- { fg = "Red", bg = "Blue", add_modifiers = { "Bold" }, sub_modifiers = {} }
```
@ -461,7 +461,7 @@ xplr.util.layout_replace(layout, "Table", "Selection")
-- {
-- Horizontal = {
-- splits = {
-- "Selection", -- Replaced
-- "Selection", -- Replacement
-- "HelpMenu",
-- },
-- config = ...

@ -231,7 +231,7 @@ pub fn node<'a>(util: Table<'a>, lua: &Lua) -> Result<Table<'a>> {
/// Get the configured [Node Type][6] of a given [Node][5].
///
/// Type: function( [Node][5], [NodeTypesConfig][7]|nil ) -> [NodeType][5]
/// Type: function( [Node][5], [xplr.config.node_types][7]|nil ) -> [NodeType][5]
///
/// If the second argument is missing, global config `xplr.config.node_types`
/// will be used.
@ -240,10 +240,10 @@ pub fn node<'a>(util: Table<'a>, lua: &Lua) -> Result<Table<'a>> {
///
/// ```lua
/// xplr.util.node_type(app.focused_node)
/// -- { style = { fg = ..., ... }, meta = { icon = ..., ... } ... }
/// -- { style = { fg = "Red", ... }, meta = { icon = "", ... } ... }
///
/// xplr.util.node_type(xplr.util.node("/foo/bar"), xplr.config.node_types)
/// -- { style = { fg = ..., ... }, meta = { icon = ..., ... } ... }
/// -- { style = { fg = "Red", ... }, meta = { icon = "", ... } ... }
/// ```
pub fn node_type<'a>(util: Table<'a>, lua: &Lua) -> Result<Table<'a>> {
let func =
@ -334,9 +334,9 @@ pub fn absolute<'a>(util: Table<'a>, lua: &Lua) -> Result<Table<'a>> {
/// Get the relative path based on the given base path or current working dir.
/// Will error if it fails to determine a relative path.
///
/// Type: function( path:string, config:Config|nil ) -> path:string
/// Type: function( path:string, options:table|nil ) -> path:string
///
/// Config type: { base:string|nil, with_prefix_dots:bookean|nil, without_suffix_dots:boolean|nil }
/// Options type: { base:string|nil, with_prefix_dots:bookean|nil, without_suffix_dots:boolean|nil }
///
/// - If `base` path is given, the path will be relative to it.
/// - If `with_prefix_dots` is true, the path will always start with dots `..` / `.`
@ -673,12 +673,12 @@ pub fn paint<'a>(util: Table<'a>, lua: &Lua) -> Result<Table<'a>> {
/// Mix multiple [Style][3] objects into one.
///
/// Type: function( [Style][3], [Style][3], ... ) -> Style[3]
/// Type: function( { [Style][3], [Style][3], ... } ) -> Style[3]
///
/// Example:
///
/// ```lua
/// xplr.util.style_mix({ fg = "Red" }, { bg = "Blue" }, { add_modifiers = {"Bold"} })
/// xplr.util.style_mix({{ fg = "Red" }, { bg = "Blue" }, { add_modifiers = {"Bold"} }})
/// -- { fg = "Red", bg = "Blue", add_modifiers = { "Bold" }, sub_modifiers = {} }
/// ```
pub fn style_mix<'a>(util: Table<'a>, lua: &Lua) -> Result<Table<'a>> {
@ -752,7 +752,7 @@ pub fn textwrap<'a>(util: Table<'a>, lua: &Lua) -> Result<Table<'a>> {
/// -- {
/// -- Horizontal = {
/// -- splits = {
/// -- "Selection", -- Replaced
/// -- "Selection", -- Replacement
/// -- "HelpMenu",
/// -- },
/// -- config = ...
@ -772,7 +772,7 @@ pub fn layout_replace<'a>(util: Table<'a>, lua: &Lua) -> Result<Table<'a>> {
Ok(res)
},
)?;
util.set("layout_replaced", func)?;
util.set("layout_replace", func)?;
Ok(util)
}

Loading…
Cancel
Save