Crates.io | nepo |
lib.rs | nepo |
version | 0.1.1 |
source | src |
created_at | 2024-05-02 17:13:30.300717 |
updated_at | 2024-05-02 19:09:41.365146 |
description | Open files in your terminal with the appropriate tool depending on the file extension |
homepage | https://github.com/fvdsn/nepo |
repository | https://github.com/fvdsn/nepo |
max_upload_size | |
id | 1227914 |
size | 65,707 |
nepo
is a cli tool that open files with a program depending on the file extension.
For example,
nepo image.png
could open it with theviu
terminal image viewer andnepo book.epub
with theepy
epub reader.
nepo
is configured at ~/.nepo.yml
with simple association rules
epubs:
ext:
- epub
- epub3
cmd: epy ${file}
nepo --mode=foo file.ext
allow you to select a different program to open the file
nepo
is best used with shell aliases such as function view() { nepo --mode=view "$@" }
Can iterate over multiple files or open them all at once.
Have a look at my personal configuration file
With cargo:
$ cargo install nepo
You must create a nepo configuration file in your home
directory named ~/.nepo.yml
.
default:
cmd: vim ${files}
epubs:
ext:
- epub
- epub3
cmd: epy ${file}
images:
ext:
- png
- jpg
cmd: viu ${files}
This yaml file contains associations that match file extensions to commands. If the file doesn't match any assocation, the top one will be used.
The cmd
configuration accepts ${file}
and ${files}
as parameters.
The singular variant contains the first filename provided, while the plural
will contains them all.
If multiple files are provided, only the files with the matching extensions will be provided to the command.
If multiple associations match a file the last one gets priority.
If you call nepo
with a mode (nepo --mode=view
), It will only consider assocations
with the selected mode.
view_json:
mode: view
ext: json
cmd: jless ${file}
You can define any mode you want, but the edit
and view
mode can be used with the
shorthands nepo --view, -v, --edit, -e