https://github.com/nnbnh/bsymlink
๐ Batch symlink tool that SuperB
https://github.com/nnbnh/bsymlink
basher bpkg cli dotfiles posix symlink terminal
Last synced: about 2 months ago
JSON representation
๐ Batch symlink tool that SuperB
- Host: GitHub
- URL: https://github.com/nnbnh/bsymlink
- Owner: NNBnh
- License: gpl-3.0
- Created: 2021-01-25T04:33:03.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-07-02T03:54:16.000Z (almost 4 years ago)
- Last Synced: 2025-03-22T15:26:30.868Z (about 1 year ago)
- Topics: basher, bpkg, cli, dotfiles, posix, symlink, terminal
- Language: Shell
- Homepage:
- Size: 56.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
bsymlink
Batch symlink tool that SuperB
## ๐ก About
`bsymlink` is a *SuperB* batch symlink tool written in [`portable sh`](https://github.com/dylanaraps/pure-sh-bible). But unlike [**Stow**](https://www.gnu.org/software/stow), it can handle conflict files like move it to the trash or delete it.
## ๐ Setup
### ๐งพ Dependencies
- [Unix commands](https://en.wikipedia.org/wiki/List_of_Unix_commands) to process
### ๐ฅ Installation
#### ๐ง Manually
Option 1: using `curl`
```sh
curl https://raw.githubusercontent.com/NNBnh/bsymlink/main/bin/bsymlink > ~/.local/bin/bsymlink
chmod +x ~/.local/bin/bsymlink
```
Option 2: using `git`
```sh
git clone https://github.com/NNBnh/bsymlink.git ~/.local/share/bsymlink
ln -s ~/.local/share/bsymlink/bin/bsymlink ~/.local/bin/bsymlink
```
#### ๐ฆ Package manager
For [Bpkg](https://github.com/bpkg/bpkg) user:
```sh
bpkg install NNBnh/bsymlink
```
For [Basher](https://github.com/basherpm/basher) user:
```sh
basher install NNBnh/bsymlink
```
> **Note** *If you can and want to port Bsymlink to other package managers, feel free to do so.*
## โจ๏ธ Usage
Run `bsymlink` in the terminal:
```sh
bsymlink path/to/directory path/to/target [path/to/trash]
```
## โ๏ธ Configuration
This is the default handle conflict command:
```sh
BSYMLINK_HANDLE="handle_conflict \"\$target\""
```
it's use this builtin `handle_conflict` function:
```sh
BSYMLINK_TRASH_PATH="${BSYMLINK_TRASH_PATH:-${XDG_DATA_HOME:-$HOME/.local/share}/Trash/files}"
handle_conflict() {
mkdir -p "$TRASH_PATH"
rm -rf "$TRASH_PATH/$(basename "$target")" 2>&-
mv -f "$target" "$TRASH_PATH/"
}
```
> **Note** *The default trash's path is `~/.local/share/Trash/files`*
You can change it through environment variables: `export BSYMLINK_HANDLE=""`
> **Note** *Keep in mind that the `` will be run through `eval` (e.g: `// => /`)*
**Examples:**
Delete conflict files:
```sh
BSYMLINK_HANDLE="rm -rf \"\$target\""
```
Using [Trash-CLI](https://github.com/andreafrancia/trash-cli):
```sh
BSYMLINK_HANDLE="trash \"\$target\""
```
## ๐ Credits
Special thanks to:
- [**Stow**](https://www.gnu.org/software/stow) by [GNU](https://www.gnu.org)
---
>
Made with โค๏ธ by NNB
>
>