Skip to content
/ bsymlink Public

πŸ”— Batch symlink tool that SuperB

License

Notifications You must be signed in to change notification settings

NNBnh/bsymlink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

31 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

bsymlink

Batch symlink tool that SuperB

License: GPL-3.0 Development completed

πŸ’‘ About

bsymlink is a SuperB batch symlink tool written in portable sh. But unlike Stow, it can handle conflict files like move it to the trash or delete it.

πŸš€ Setup

🧾 Dependencies

πŸ“₯ Installation

πŸ”§ Manually

Option 1: using curl

curl https://raw.githubusercontent.com/NNBnh/bsymlink/main/bin/bsymlink > ~/.local/bin/bsymlink
chmod +x ~/.local/bin/bsymlink

Option 2: using git

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 user:

bpkg install NNBnh/bsymlink

For Basher user:

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:

bsymlink path/to/directory path/to/target [path/to/trash]

βš™οΈ Configuration

This is the default handle conflict command:

BSYMLINK_HANDLE="handle_conflict \"\$target\""

it's use this builtin handle_conflict function:

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="<command>"

Note Keep in mind that the <method> will be run through eval (e.g: // => /)

Examples:

Delete conflict files:

BSYMLINK_HANDLE="rm -rf \"\$target\""

Using Trash-CLI:

BSYMLINK_HANDLE="trash \"\$target\""

πŸ’Œ Credits

Special thanks to:






Made with ❀️ by NNB

Buy Me a Coffee