Portable bin-directory anchor for shell scripts — use sibling tools from anywhere
Project description
binabra
Portable bin directory anchor for shell scripts. Install once, reuse the same header anywhere.
- PyPI:
binabra - CLI:
abra(the spell name stays short) - Next in family:
kadabra(related tool, coming later)
Install
pip install binabra
Ensure pip's script dir is on PATH (macOS example):
export PATH="$HOME/Library/Python/3.9/bin:$PATH"
Use anywhere
At the top of any shell script:
source "$(abra sh)"
exec "$BIN/my-sibling-tool" "$@"
BIN becomes the directory containing your script.
Bootstrap a project
abra init # creates ./bin/abra
abra colocate bin # copy abra into existing bin/
Co-located scripts:
source "$(dirname "${BASH_SOURCE[0]}")/abra"
exec "$BIN/other-script" "$@"
CLI
| Command | Purpose |
|---|---|
abra sh |
Path to anchor.sh for sourcing |
abra embed |
Print source "$(abra sh)" |
abra dir |
Discover bin (ABRA_BIN, project bin/, ~/.local/bin) |
abra exec tool args |
Run sibling from discovered bin |
abra init [dir] |
Create bin/abra in a project |
abra colocate [dest] |
Copy abra into a bin folder |
Publish to PyPI
1. Create an API token
https://pypi.org/manage/account/token/
- Scope: Entire account (first time) or Project: binabra (after first upload)
- Copy the token (
pypi-...)
2. Build
cd ~/Projects/binabra
python3 -m pip install --user build twine
python3 -m build
3. Upload
export TWINE_USERNAME=__token__
export TWINE_PASSWORD=pypi-YOUR-TOKEN-HERE
twine upload dist/*
Or enter credentials when prompted:
twine upload dist/*
# username: __token__
# password: pypi-...
4. Verify
pip install binabra
abra --version
abra embed
PyPI project page: https://pypi.org/project/binabra/
Python API
from binabra import anchor_dir, sibling, discover_bin
anchor_dir(__file__)
sibling("run.sh", __file__)
discover_bin()
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 binabra-0.1.0.tar.gz.
File metadata
- Download URL: binabra-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90d10bb925b1078d287f062eb899db4f8c82254a4b37a3c26ffb19312eb29557
|
|
| MD5 |
b1b94d13317ef4d9eb57304a07600c8b
|
|
| BLAKE2b-256 |
f247e39b0fdec20ff9b32f3f2a9147c9daf613b5ebda145f674e5b8b720e6bbe
|
File details
Details for the file binabra-0.1.0-py3-none-any.whl.
File metadata
- Download URL: binabra-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecd0dcc8573fe289eaa7b10c4fd5fc1a95c7e894a8f7bfcdde596627139c1ea1
|
|
| MD5 |
0a507270b5ecd1bb341fafa410e6fd25
|
|
| BLAKE2b-256 |
78cf7b5fe25f35dc9086a7324004458382b4a05445f3796941fe10cb695ca6a4
|