diff --git a/Cargo.lock b/Cargo.lock index e4df279..45f5709 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1351,7 +1351,7 @@ checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" [[package]] name = "xplr" -version = "0.20.0-beta.3" +version = "0.20.0" dependencies = [ "ansi-to-tui", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 8cd3b0e..e7e21c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ path = './benches/criterion.rs' [package] name = 'xplr' -version = '0.20.0-beta.3' +version = '0.20.0' authors = ['Arijit Basu '] edition = '2021' description = 'A hackable, minimal, fast TUI file explorer' diff --git a/docs/en/src/SUMMARY.md b/docs/en/src/SUMMARY.md index 07eda13..daab150 100644 --- a/docs/en/src/SUMMARY.md +++ b/docs/en/src/SUMMARY.md @@ -34,7 +34,6 @@ - [Awesome Plugins][18] - [Integration][19] - [Awesome Integrations][20] -- [TODO][21] - [Alternatives][22] - [Upgrade Guide][23] - [Community][24] @@ -60,7 +59,6 @@ [18]: awesome-plugins.md [19]: integration.md [20]: awesome-integrations.md -[21]: todo.md [22]: alternatives.md [23]: upgrade-guide.md [24]: community.md diff --git a/docs/en/src/filtering.md b/docs/en/src/filtering.md index 9b29375..69bc2a9 100644 --- a/docs/en/src/filtering.md +++ b/docs/en/src/filtering.md @@ -68,8 +68,6 @@ A filter can be one of the following: - "IAbsolutePathDoesMatchRegex" - "IAbsolutePathDoesNotMatchRegex" -TODO: document each - ### input Type: string diff --git a/docs/en/src/introduction.md b/docs/en/src/introduction.md index 435cbef..d48d8ce 100644 --- a/docs/en/src/introduction.md +++ b/docs/en/src/introduction.md @@ -53,14 +53,17 @@ to lose some kb if it makes sense. Some of the coolest features xplr provide beside the basic stuff: - [Embedded LuaJIT][5] for portability and extensibility. -- [A simple system based on message passing][10] to control xplr session using: +- [A simple modal system based on message passing][10] to control xplr session + using: - [Keyboard inputs][11] - [Shell Commands][12] - [Lua Functions][13] -- [Readline-like input buffer][9] with customizable behaviour to read user + - [Hooks][22] +- Easy, typesafe message passing with `-m MSG` or `-M MSG` subcommands. +- [Readline-like input buffer][9] with customizable behavior to read user inputs. -- [Switchable recover mode][7] that saves you from doing unwanted things when in a - hurry. +- [Switchable recover mode][7] that saves you from doing unwanted things when + in a hurry. - [Customizable layouts][1] with built-in panels. For e.g. - **Selection list** to show you the selected paths in real-time. - **Help menu** to show you the available keys bindings in each mode. @@ -69,6 +72,7 @@ Some of the coolest features xplr provide beside the basic stuff: - [Custom file properties][17] with custom colors can be displayed in the table. - [FIFO manager][19] to manage a FIFO file that can be used to [integrate with previewers][6]. +- [Virtual root][21] with `--vroot` and `:v` key bindings. - **Different quit options:** - Quit with success without any output (`q`). - Quit with success and the result printed on stdout (`enter`). @@ -88,10 +92,10 @@ Some of the coolest features xplr provide beside the basic stuff: [4]: https://github.com/sayanarijit/xplr/tree/main/benches [5]: https://github.com/sayanarijit/xplr/discussions/183 [6]: https://github.com/sayanarijit/xplr/pull/229 -[7]: general-config.md#enable_recover_mode +[7]: modes.md#xplrconfigmodesbuiltinrecover [8]: default-key-bindings.md [9]: https://github.com/sayanarijit/xplr/pull/397 -[10]: message.md +[10]: messages.md [11]: configure-key-bindings.md [12]: mode.md#input-pipe [13]: lua-function-calls.md @@ -100,5 +104,7 @@ Some of the coolest features xplr provide beside the basic stuff: [16]: awesome-hacks.md [17]: node_types.md [18]: https://github.com/sayanarijit/xplr/blob/main/src/init.lua -[19]: message.md#startfifo +[19]: messages.md#startfifo [20]: community.md +[21]: messages.md#virtual-root +[22]: configuration.md#hooks diff --git a/docs/en/src/layout.md b/docs/en/src/layout.md index 25b3733..cccdca9 100644 --- a/docs/en/src/layout.md +++ b/docs/en/src/layout.md @@ -160,8 +160,6 @@ A constraint can be one of the following: - { MinLessThanLayoutHeight = int } - { MinLessThanLayoutWidth = int } -TODO: document each constraint. - ## splits Type: list of [Layout][3] diff --git a/docs/en/src/lua-function-calls.md b/docs/en/src/lua-function-calls.md index 14c45b5..cf98b5c 100644 --- a/docs/en/src/lua-function-calls.md +++ b/docs/en/src/lua-function-calls.md @@ -8,6 +8,34 @@ When called the function receives a [special argument][14] that contains some useful information. The function can optionally return a list of messages which will be handled by xplr. +## Example: Using Lua Function Calls + +```lua +-- Define the function +xplr.fn.custom.ask_name_and_greet = function(app) + print("What's your name?") + + local name = io.read() + local greeting = "Hello " .. name .. "!" + local message = greeting .. " You are inside " .. app.pwd + + return { + { LogSuccess = message }, + } +end + +-- Map the function to a key (space) +xplr.config.modes.builtin.default.key_bindings.on_key.space = { + help = "ask name and greet", + messages = { + { CallLua = "custom.ask_name_and_greet" } + } +} + +-- Now, when you press "space" in default mode, you will be prompted for your +-- name. Enter your name to receive a nice greeting and to know your location. +``` + ## Lua Context This is a special argument passed to the lua functions when called using the @@ -105,7 +133,9 @@ The session path. ### explorer_config -[TODO][66] +Type: [ExplorerConfig][66] + +The configuration for exploring paths. ### history @@ -313,33 +343,48 @@ Type: list of string Visited paths. -## Example: Using Lua Function Calls +## Explorer Config -```lua --- Define the function -xplr.fn.custom.ask_name_and_greet = function(app) - print("What's your name?") +Explorer config contains the following fields: - local name = io.read() - local greeting = "Hello " .. name .. "!" - local message = greeting .. " You are inside " .. app.pwd +- [filters][77] +- [sorters][78] +- [searchers][79] - return { - { LogSuccess = message }, - } -end +### filters --- Map the function to a key (space) -xplr.config.modes.builtin.default.key_bindings.on_key.space = { - help = "ask name and greet", - messages = { - { CallLua = "custom.ask_name_and_greet" } - } -} +List of filters to apply. --- Now, when you press "space" in default mode, you will be prompted for your --- name. Enter your name to receive a nice greeting and to know your location. -``` +Type: list of [Node Filter Applicable][80] + +### sorters + +Add list or sorters to the pipeline. + +Type: list of [Node Sorter Applicable][81] + +### searchers + +Type: nullable [Node Searcher][82] + +## Node Searcher + +Node Searcher contains the following fields: + +- [pattern][83] +- [recoverable_focus][84] + +### pattern + +The patters used to search. + +Type: string + +### recoverable_focus + +Where to focus when search is cancelled. + +Type: nullable string [7]: https://www.json.org [8]: modes.md#mode @@ -389,7 +434,7 @@ xplr.config.modes.builtin.default.key_bindings.on_key.space = { [63]: #nodes [64]: #total [65]: #focus -[66]: https://docs.rs/xplr/latest/xplr/app/struct.ExplorerConfig.html +[66]: #explorer-config [67]: #history [68]: #loc [69]: #paths @@ -400,3 +445,11 @@ xplr.config.modes.builtin.default.key_bindings.on_key.space = { [74]: #gid [75]: #vroot [76]: #initial_pwd +[77]: #filters +[78]: #sorters +[79]: #searchers +[80]: filtering.md#node-filter-applicable +[81]: sorting.md#node-sorter-applicable +[82]: #node-searcher +[83]: #pattern +[84]: #recoverable_focus diff --git a/docs/en/src/messages.md b/docs/en/src/messages.md index 852c176..3a55bce 100644 --- a/docs/en/src/messages.md +++ b/docs/en/src/messages.md @@ -1,6 +1,6 @@ # Full List of Messages -xplr messages categorized based on their purpose. +xplr [messages][1] categorized based on their purpose. ## Categories @@ -1251,4 +1251,6 @@ Example: ## Also See: -- [Message](message.md) +- [Message][1] + +[1]: message.md diff --git a/docs/en/src/sorting.md b/docs/en/src/sorting.md index 2cf9e4e..671e82f 100644 --- a/docs/en/src/sorting.md +++ b/docs/en/src/sorting.md @@ -62,8 +62,6 @@ A sorter can be one of the following: - "BySymlinkCreated" - "BySymlinkLastModified" -TODO: document each - ### reverse Type: boolean diff --git a/docs/en/src/todo.md b/docs/en/src/todo.md deleted file mode 100644 index 4c98d65..0000000 --- a/docs/en/src/todo.md +++ /dev/null @@ -1,34 +0,0 @@ -# TODO - -- [x] Saner key bindings. -- [x] Pipes. -- [x] Native search & filter. -- [x] Create, copy, move, delete files directly. -- [x] logging support. -- [x] Version compatibility instructions. -- [x] Implement CLI arguments. -- ~Add support for tabs and/or panes (non native)~ [hacked][1] | [discussion][2] -- ~Implement bookmarks.~ [hacked][3] -- [x] Add sorting support. -- [x] Add filter support. -- [x] File previews. -- [x] Implement plugins support (or some way to easily share configuration). -- [x] Bigger (and better) help menu. -- [x] Offline docs. -- [ ] Support for background services -- [x] ~Customize~ switch UI at run-time. -- [ ] More tests and benchmarks. -- [ ] Measure code coverage. -- [ ] Improve the [vim plugin][4]. -- [ ] Cleanup, refactor, optimize. - -[add more][5] - -Like this project so far? **[Please consider contributing][6].** - -[1]: https://github.com/sayanarijit/xplr/wiki/Hacks#spawn-multiple-sessions-in-different-windows -[2]: https://github.com/sayanarijit/xplr/discussions/15 -[3]: https://github.com/sayanarijit/xplr/wiki/Hacks#bookmark -[4]: https://github.com/sayanarijit/xplr.vim -[5]: https://github.com/sayanarijit/xplr/discussions/2 -[6]: contribute.md diff --git a/docs/en/src/upgrade-guide.md b/docs/en/src/upgrade-guide.md index d510f62..6bd0886 100644 --- a/docs/en/src/upgrade-guide.md +++ b/docs/en/src/upgrade-guide.md @@ -45,7 +45,7 @@ compatibility. ### Instructions -#### [v0.19.4][47] -> [v0.20.0-beta.3][48] +#### [v0.19.4][47] -> [v0.20.0][48] - BREAKING: xplr shell (`:!`) will default to null (`\0`) delimited pipes, as opposed to newline (`\n`) delimited ones (i.e. will use `Call0` instead of @@ -74,6 +74,9 @@ compatibility. - UnsetVroot - ToggleVroot - ResetVroot +- Use `$XPLR_INITIAL_PWD` and Lua equivalent to implement workspace like + features without using virtual root. Use keys `gi` to go to the initial + working directory from anywhere. #### [v0.18.0][46] -> [v0.19.4][47] @@ -432,4 +435,4 @@ Else do the following: [45]: https://github.com/sayanarijit/xplr/releases/tag/v0.17.6 [46]: https://github.com/sayanarijit/xplr/releases/tag/v0.18.0 [47]: https://github.com/sayanarijit/xplr/releases/tag/v0.19.4 -[48]: https://github.com/sayanarijit/xplr/releases/tag/v0.20.0-beta.3 +[48]: https://github.com/sayanarijit/xplr/releases/tag/v0.20.0 diff --git a/docs/script/generate.py b/docs/script/generate.py index 378cae1..6f92ef0 100644 --- a/docs/script/generate.py +++ b/docs/script/generate.py @@ -9,7 +9,7 @@ from typing import List MESSAGES_DOC_TEMPLATE = """ # Full List of Messages -xplr messages categorized based on their purpose. +xplr [messages][1] categorized based on their purpose. ## Categories @@ -19,7 +19,9 @@ xplr messages categorized based on their purpose. ## Also See: -- [Message](message.md) +- [Message][1] + +[1]: message.md """.strip() CONFIGURATION_DOC_TEMPLATE = """ diff --git a/src/lua.rs b/src/lua.rs index 2dc91b4..d597190 100644 --- a/src/lua.rs +++ b/src/lua.rs @@ -155,24 +155,24 @@ mod tests { assert!(check_version(VERSION, "foo path").is_ok()); // Current release if OK - assert!(check_version("0.20.0-beta.3", "foo path").is_ok()); + assert!(check_version("0.20.0", "foo path").is_ok()); // Prev major release is ERR // - Not yet // Prev minor release is ERR (Change when we get to v1) - assert!(check_version("0.19.0-beta.3", "foo path").is_err()); + assert!(check_version("0.19.0", "foo path").is_err()); // Prev bugfix release is OK // assert!(check_version("0.20.-1", "foo path").is_ok()); // Next major release is ERR - assert!(check_version("1.20.0-beta.3", "foo path").is_err()); + assert!(check_version("1.20.0", "foo path").is_err()); // Next minor release is ERR - assert!(check_version("0.21.0-beta.3", "foo path").is_err()); + assert!(check_version("0.21.0", "foo path").is_err()); // Next bugfix release is ERR (Change when we get to v1) - assert!(check_version("0.20.1-beta.3", "foo path").is_err()); + assert!(check_version("0.20.1", "foo path").is_err()); } } diff --git a/src/runner.rs b/src/runner.rs index e4705d1..a6417cb 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -349,8 +349,6 @@ impl Runner { match msg { // NOTE: Do not schedule critical tasks via tx_msg_in in this loop. // Try handling them immediately. - // - // TODO: Remove boilerplate code. Enque(task) => { tx_msg_in.send(task)?; }