Giter VIP home page Giter VIP logo

bsymlink's Introduction

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

bsymlink's People

Contributors

nnbnh avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

bsymlink's Issues

Inconsistant linking behavior dependend on target

Is it correct that in the case of non-existent subfolder directories, the subfolders are linked and in another case only the files in a subfolder are linked? It is confusing because it is not written anywhere.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.