From ad2626c4c913e4101b9331330e363682cd257773 Mon Sep 17 00:00:00 2001 From: Brad Culwell Date: Tue, 25 Jun 2024 21:06:43 +0000 Subject: [PATCH] docs: update docs for v0.9.1 --- docs/cli.md | 6 +++++ docs/clients/download_torrent_file.md | 11 +++++++++ docs/clipboard.md | 9 +++---- docs/general_config.md | 2 ++ docs/home-manager.md | 34 +++++++++++++++++++++++++++ docs/keybinds.md | 4 ++-- 6 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 docs/cli.md create mode 100644 docs/home-manager.md diff --git a/docs/cli.md b/docs/cli.md new file mode 100644 index 0000000..895c179 --- /dev/null +++ b/docs/cli.md @@ -0,0 +1,6 @@ +# Command-line options +There are a few command line options that can be supplied when running nyaa. They are: +| Option | Description | +| -------------------------- | ---------------------------------------------------------- | +| `-V/-v/--version` | Print the current version of `nyaa` | +| `--config=/path/to/config` | Override the path to the config folder (not `config.toml`) | diff --git a/docs/clients/download_torrent_file.md b/docs/clients/download_torrent_file.md index a1bdc23..eb2787e 100644 --- a/docs/clients/download_torrent_file.md +++ b/docs/clients/download_torrent_file.md @@ -11,4 +11,15 @@ download_client = "DownloadTorrentFile" [client.download] save_dir = "~/Downloads" # required +filename = "{file}" # The name to save the file as +overwrite = true # Whether to overwrite the file if it already exists +create_root_dir = true # Whether to create parent directories if they do not exist ``` + +## Filename +The format of the filename to save can use substitutions to add information. The allowed substitutions are: +| Pattern | Substitute | +| ------------ | ------------------------------------------------------------------------------------- | +| `{file}` | The file name stored in the source webpage (like `123456.torrent` or `Title.torrent`) | +| `{basename}` | The basename of the file stored in the source webpage (like `123456` or `Title`) | +| `{hash}` | The torrent's hash | diff --git a/docs/clipboard.md b/docs/clipboard.md index 7b3c122..ee45b2d 100644 --- a/docs/clipboard.md +++ b/docs/clipboard.md @@ -3,9 +3,9 @@ You can configure the way copying works in nyaa using several options. The confi ```toml [clipboard] osc52 = true -selection = "..." -cmd = "..." -shell_cmd = "..." +selection = ["..."] # optional +cmd = "..." # optional +shell_cmd = "..." # optional ``` They are prioritized in the order `cmd` $\rightarrow$ `osc52` $\rightarrow$ `selection` @@ -34,6 +34,7 @@ By default, `cmd` is undefined so nyaa uses [OSC52](https://www.reddit.com/r/vim | [windows terminal](https://github.com/microsoft/terminal) | **yes** | | [xterm.js](https://xtermjs.org/) (Hyper terminal) | **yes** | | [zellij](https://github.com/zellij-org/zellij/) | **yes** | + Source: [vim-oscyank](https://github.com/ojroques/vim-oscyank) If your terminal is not supported, you should disable OSC52 by adding @@ -47,7 +48,7 @@ to your `config.toml`. This will make nyaa use an alternative method for copying For those using X11, you can change the option `x11_selection` to either `Clipboard`, `Primary`, or `Secondary` to change which selection X11 will copy the content into. This would look like: ```toml [clipboard] -selection = "Primary" +selection = "Primary" # can also be a list, like ["Primary", "Clipboard"] ``` ## cmd diff --git a/docs/general_config.md b/docs/general_config.md index 8f320f2..ddc0c61 100644 --- a/docs/general_config.md +++ b/docs/general_config.md @@ -17,8 +17,10 @@ theme = "Dracula" # the theme to use by default default_source = "Nyaa" # the source to use by default download_client = "qBittorrent" # the download client to use by default timeout = 30 # request timeout for sources and clients (measured in seconds) +cursor_padding = 4 # cursor padding for input fields scroll_padding = 6 # scroll padding for results table save_config_on_change = true # save config when changing sources/themes +hot_reload_config = true # hot-reload config on change # ... ``` diff --git a/docs/home-manager.md b/docs/home-manager.md new file mode 100644 index 0000000..d415de2 --- /dev/null +++ b/docs/home-manager.md @@ -0,0 +1,34 @@ +# Home-manager +When using home-manager, you can import a custom module to configure nyaa. + +First, add to `inputs` in `flake.nix`: +```nix +nyaa = { + url = "github:Beastwick18/nyaa"; + inputs.nixpkgs.follows = "nixpkgs"; +}; +``` + +Then, add to `home.nix` imports and enable nyaa: +```nix +imports = [ + inputs.nyaa.homeManagerModule +] +programs.nyaa.enable = true; +``` + +## Options +Most options available in the `config.toml` file can be configured through home-manager. The only option not available is +`save_config_on_change`. This is because the value should always be `false` since the config will be saved to the nix store, +which is read-only. + +For global options (not in a table), you can modify them with `programs.nyaa.*`. So to change the timeout, you could write: +```nix +programs.nyaa.timeout = 45; +``` + +For tables, such as `client.qBittorrent`, you would access it like `programs.nyaa.client.qBittorrent.*` +and add the property you want to change in the attribute set. So to change the base_url, you would write: +```nix +programs.nyaa.client.qBittorrent.base_url = "..."; +``` diff --git a/docs/keybinds.md b/docs/keybinds.md index 2ff8957..d545ca7 100644 --- a/docs/keybinds.md +++ b/docs/keybinds.md @@ -18,9 +18,9 @@ This mode is entered when the results table is focused. | P, H | First Page | | r | Reload | | o | Open in browser | -| yt, ym, yp, yi | Copy torrent link/magnet link/post link/imdb id | +| yt, ym, yp, yi, yn | Copy torrent/magnet/post link/imdb id/name | | Space | Toggle item for batch download | -| Ctrl-Space | Multi-line select torrents | +| v/V/Ctrl-Space | Enter visual add/remove/toggle mode | | Tab/Shift-Tab | Switch to Batches| | /, i | Search | | c | Categories |