A TUI to change the target of a symlink.
Project description
symlink-editor
A TUI (text based user interface) written in Python with prompt-toolkit to edit symlinks.
Features:
- The color of the frame indicates whether the target exists or not.
- The color of the path indicates which part of the path is broken.
- The cursor is placed at the beginning of the broken part of the path.
- Tab completion and completion menu showing all existing files and directories at the cursor position.
Installation
This program is distributed via PyPI so you can easily install it with pipx:
$ pipx install symlink-editor
Usage in a terminal
$ symlink-editor path/to/symlink
Integration in other terminal applications
If you want to integrate this program into yazi, ranger or other terminal applications I recommend to use the --window flag.
With that all feedback such as error messages or updated link will be displayed in a prompt toolkit window instead of printed to stdout so that they won't be overwritten by the other application before you can read them.
You can dismiss the window by pressing Enter, Ctrl+C or Q.
Note that the --window flag can only take effect after all command line arguments have been parsed.
That means that it does not apply to error messages from incorrect command line arguments and the output of --help and --version.
For yazi you can add the following to ~/.config/yazi/keymap.toml:
[[manager.prepend_keymap]]
on = [ "e", "l" ]
run = 'shell --block "symlink-editor --window \"$0\""'
desc = "edit symlink"
License
This is free software. It is licensed under the BSD Zero Clause License. You can freely use, modify, and distribute it. See LICENSE.
Running the tests
I am using mypy for static type checking and pytest for dynamic testing.
tox creates a virtual environment and installs all dependencies for you.
You can install tox with pipx (pipx install tox).
$ tox
In order to make tox work without an internet connection install devpi:
$ pipx install devpi-server
$ devpi-init
$ devpi-gen-config
$ su
# cp gen-config/devpi.service /etc/systemd/system/
# systemctl start devpi.service
# systemctl enable devpi.service
and add the following line to your bashrc:
export PIP_INDEX_URL=http://localhost:3141/root/pypi/+simple/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file symlink_editor-1.0.0.tar.gz.
File metadata
- Download URL: symlink_editor-1.0.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
747d4c470a0e2eba4a1e8b2d5cb362c1f8a0b6b5bdef97c61fc76f232b1062ee
|
|
| MD5 |
2d5393324b5531b9f297a6dac456682b
|
|
| BLAKE2b-256 |
ef448ea8e03ad5a48f1dfdbc4ccaf70f2911ba2aa9ceb12d6ee9d9eb1705b50e
|
File details
Details for the file symlink_editor-1.0.0-py3-none-any.whl.
File metadata
- Download URL: symlink_editor-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d7cae722b8da6b219f7ac9ce3aff02e51d7c6461154d0019ef21716101a0c6c
|
|
| MD5 |
3398d73c133b55fc09f35d5fa8207e86
|
|
| BLAKE2b-256 |
56906a38222d57bc39dd92da8a9949d977ebf046c9b3745cef160ef3450093e5
|