Skip to content

Commit

Permalink
fix(docs): add link to docs in README
Browse files Browse the repository at this point in the history
  • Loading branch information
pysan3 committed Jan 30, 2024
1 parent 227f409 commit f9f6b4c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 42 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ jobs:
- name: Build docs
shell: bash
run: |
pip install myst-parser pydata-sphinx-theme sphinx-lua sphinx-press-theme sphinx
cat "$GITHUB_PATH"
echo "$PATH"
ls -la "$HOME/.local/bin" || true
pip show --files sphinx | grep 'bin'
python3 -m site --user-base
pip install -r ./requirements.txt
PATH="$PATH:$(python3 -m site --user-base)/bin" make html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
Expand Down
53 changes: 18 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,24 @@
</p>
</div>

**This is still very WIP. Will be available in February at the
earliest.**
**This is still very WIP. Will be available in February at the earliest.**

[![Neovim](https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white)](https://neovim.io/)
[![Lua](https://img.shields.io/badge/lua-%232C2D72.svg?style=for-the-badge&logo=lua&logoColor=white)](https://www.lua.org/)
[![Neovim](https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white)](https://neovim.io/) [![Lua](https://img.shields.io/badge/lua-%232C2D72.svg?style=for-the-badge&logo=lua&logoColor=white)](https://www.lua.org/)

[![MLP-2.0](https://img.shields.io/github/license/pysan3/pathlib.nvim.svg?style=for-the-badge)](https://github.com/pysan3/pathlib.nvim/blob/master/LICENSE)
[![Issues](https://img.shields.io/github/issues/pysan3/pathlib.nvim.svg?style=for-the-badge)](https://github.com/pysan3/pathlib.nvim/issues)
[![Build
Status](https://img.shields.io/github/actions/workflow/status/pysan3/pathlib.nvim/lua_ls-typecheck.yml?style=for-the-badge)](https://github.com/pysan3/pathlib.nvim/actions/workflows/lua_ls-typecheck.yml)
[![LuaRocks](https://img.shields.io/luarocks/v/pysan3/pathlib.nvim?logo=lua&color=purple&style=for-the-badge)](https://luarocks.org/modules/pysan3/pathlib.nvim)
[![MLP-2.0](https://img.shields.io/github/license/pysan3/pathlib.nvim.svg?style=for-the-badge)](https://github.com/pysan3/pathlib.nvim/blob/master/LICENSE) [![Issues](https://img.shields.io/github/issues/pysan3/pathlib.nvim.svg?style=for-the-badge)](https://github.com/pysan3/pathlib.nvim/issues) [![Build Status](https://img.shields.io/github/actions/workflow/status/pysan3/pathlib.nvim/lua_ls-typecheck.yml?style=for-the-badge)](https://github.com/pysan3/pathlib.nvim/actions/workflows/lua_ls-typecheck.yml) [![LuaRocks](https://img.shields.io/luarocks/v/pysan3/pathlib.nvim?logo=lua&color=purple&style=for-the-badge)](https://luarocks.org/modules/pysan3/pathlib.nvim)

# 🐍 `pathlib.nvim`

This plugin aims to decrease the difficulties of path management across
mutliple OSs in neovim. The plugin API is heavily inspired by Python's
`pathlib.Path` with tweaks to fit neovim usage. It is mainly used in
[neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) but it
is very simple and portable to be used in any plugin.
This plugin aims to decrease the difficulties of path management across mutliple OSs in neovim. The plugin API is heavily inspired by Python's `pathlib.Path` with tweaks to fit neovim usage. It is mainly used in [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) but it is very simple and portable to be used in any plugin.

- [Documentation](https://pysan3.github.io/pathlib.nvim/)
- Module References
- [`PathlibPath`](https://pysan3.github.io/pathlib.nvim/doc/PathlibPath.html): base class with operations.
- [`PathlibPosixPath`](https://pysan3.github.io/pathlib.nvim/doc/PathlibPosixPath.html): posix system specific.
- [`PathlibWindowsPath`](https://pysan3.github.io/pathlib.nvim/doc/PathlibWindowsPath.html): posix system specific.
- 🔎 Search for Keyword
- [Search](https://pysan3.github.io/pathlib.nvim/search.html)
- [Index](https://pysan3.github.io/pathlib.nvim/genindex.html)

# ✨ Benefits

Expand Down Expand Up @@ -55,11 +54,7 @@ file_a.git_state.git_root -- root directory of the repo

## ⏱️ Sync / Async Operations

The API is designed so it is very easy to switch between sync and async
operations. Call them inside [nvim-nio
task](https://github.com/nvim-neotest/nvim-nio) without any change, and
the operations are converted to be async (does not block the main
thread).
The API is designed so it is very easy to switch between sync and async operations. Call them inside [nvim-nio task](https://github.com/nvim-neotest/nvim-nio) without any change, and the operations are converted to be async (does not block the main thread).

``` lua
local foo = Path("~/Documents/foo.txt")
Expand Down Expand Up @@ -103,15 +98,12 @@ assert(tostring(bar) == "folder/bar.txt")
### Path object is stored with `string[]`.

- Very fast operations to work with parents / children / siblings.

- No need to worry about path separator =\> OS Independent.

- `/`: Unix, `\`: Windows

### Nicely integrated with vim functions.

There are wrappers around vim functions such as `fnamemodify`, `stdpath`
and `getcwd`.
There are wrappers around vim functions such as `fnamemodify`, `stdpath` and `getcwd`.

``` lua
path:modify(":p:t:r") -- vim.fn.fnamemodify
Expand Down Expand Up @@ -159,10 +151,7 @@ end

## Async Execution

This library uses [nvim-nio](https://github.com/nvim-neotest/nvim-nio)
under the hood to run async calls. Supported methods will turn into
async calls inside a `nio.run` environment and has the **EXACT SAME
INTERFACE**.
This library uses [nvim-nio](https://github.com/nvim-neotest/nvim-nio) under the hood to run async calls. Supported methods will turn into async calls inside a `nio.run` environment and has the **EXACT SAME INTERFACE**.

``` lua
local nio = require("nio")
Expand All @@ -177,9 +166,7 @@ end)
vim.print("sync here") -- prints first (maybe not if above functions end very fast)
```

When execution fails, function will return `nil` and the error message
is captured into `self.error_msg`. This property holds the error message
of the latest async function call.
When execution fails, function will return `nil` and the error message is captured into `self.error_msg`. This property holds the error message of the latest async function call.

``` lua
nio.run(function ()
Expand All @@ -193,18 +180,14 @@ end)
# TODO

- [ ] API documentation.

- [ ] Git operation integration.

- [ ] Windows implementation, test environment.

# Contributions

I am not thinking of merging any PRs yet but feel free to give me your
opinions with an issue.
I am not thinking of merging any PRs yet but feel free to give me your opinions with an issue.

# Other Projects

- Python `pathlib`

- <https://docs.python.org/3/library/pathlib.html>
11 changes: 10 additions & 1 deletion README.norg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description:
authors: takuto
categories:
created: 2023-11-14
updated: 2024-01-29T17:41:30+0900
updated: 2024-01-30T23:09:30+0900
version: 1.1.1
@end

Expand Down Expand Up @@ -35,6 +35,15 @@ version: 1.1.1
It is mainly used in {https://github.com/nvim-neo-tree/neo-tree.nvim}[neo-tree.nvim]
but it is very simple and portable to be used in any plugin.

- {https://pysan3.github.io/pathlib.nvim/}[Documentation]
- Module References
-- {https://pysan3.github.io/pathlib.nvim/doc/PathlibPath.html}[`PathlibPath`]: base class with operations.
-- {https://pysan3.github.io/pathlib.nvim/doc/PathlibPosixPath.html}[`PathlibPosixPath`]: posix system specific.
-- {https://pysan3.github.io/pathlib.nvim/doc/PathlibWindowsPath.html}[`PathlibWindowsPath`]: posix system specific.
- 🔎 Search for Keyword
-- {https://pysan3.github.io/pathlib.nvim/search.html}[Search]
-- {https://pysan3.github.io/pathlib.nvim/genindex.html}[Index]

* ✨ Benefits
** 📦 Intuitive and Useful Methods
@code lua
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ myst-parser
pydata-sphinx-theme
sphinx-lua
sphinx-press-theme
sphinx

0 comments on commit f9f6b4c

Please sign in to comment.