Skip to content

Commit 15317b6

Browse files
committed
docs: Add 'local' installation example
1 parent 2130030 commit 15317b6

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

README.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ This symlinks all executable scripts to a common directory. It does this for com
2020

2121
```sh
2222
$ ls -l --color=always ~/.local/share/bpm/cellar/bin/
23-
... bash2048.sh -> /home/edwin/.local/share/bpm/cellar/packages/JosefZIla/bash2048/bash2048.sh
24-
... bashtop -> /home/edwin/.local/share/bpm/cellar/packages/aristocratos/bashtop/bashtop
25-
... git-alias -> /home/edwin/.local/share/bpm/cellar/packages/tj/git-extras/bin/git-alias
26-
... git-archive-file -> /home/edwin/.local/share/bpm/cellar/packages/tj/git-extras/bin/git-archive-file
23+
... bash2048.sh -> /home/edwin/.local/share/bpm/cellar/packages/github.com/JosefZIla/bash2048/bash2048.sh
24+
... bashtop -> /home/edwin/.local/share/bpm/cellar/packages/github.com/aristocratos/bashtop/bashtop
25+
... git-alias -> /home/edwin/.local/share/bpm/cellar/packages/github.com/tj/git-extras/bin/git-alias
26+
... git-archive-file -> /home/edwin/.local/share/bpm/cellar/packages/github.com/tj/git-extras/bin/git-archive-file
2727
...
2828
```
2929

@@ -34,8 +34,45 @@ export PATH="${XDG_DATA_HOME:-$HOME/.local/share}/bpm/source/pkg/bin:$PATH"
3434
eval "$(bpm init bash)" # replace 'bash' with your shell
3535
```
3636

37+
STATUS: ALPHA
38+
3739
See [Getting Started](./docs/getting-started.md) for more details
3840

41+
## Local Package Development
42+
43+
If you are working on a project, and want to pull in a dependency, say [bash-args](https://github.com/eankeen/bash-args), the workflow looks like this
44+
45+
To use the packages, simply append to the `PATH` variable in your script entrypoint (script.sh in the example below). Note that exporting it isn't required because it's already an exported variable
46+
47+
```sh
48+
mkdir 'my-project' && cd 'my-project'
49+
50+
# Creating a 'bpm.toml' is required so bpm knows where
51+
# the root of the project is
52+
touch 'bpm.toml'
53+
54+
bpm add 'eankeen/bash-args'
55+
56+
cat > 'script.sh' <<-"OUTEREOF"
57+
#!/usr/bin/env bash
58+
59+
PATH="$PWD/bpm_packages/bin:$PATH"
60+
61+
declare -A args=()
62+
63+
# 'bash-args' requires that we use `source`
64+
source bash-args parse "$@" <<-"EOF"
65+
@flag [port.p] {3000} - The port to open on
66+
EOF
67+
68+
echo "Using port '${args[port]}'"
69+
OUTEREOF
70+
71+
chmod +x './script.sh'
72+
./script.sh # Using port '3000'
73+
./script.sh --port 4000 # Using port '4000'
74+
```
75+
3976
## Alternatives Comparison
4077

4178
Why not use `bpkg` or `Basher`? Because `bpm`...

pkg/lib/cmd/bpm.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ may_reset_bpm_vars() {
127127

128128
do_set_bpm_vars() {
129129
local project_root_dir="$1"
130+
ensure.non_zero 'project_root_dir' "$project_root_dir"
130131

131132
BPM_ROOT="$project_root_dir"
132133
BPM_PREFIX="$project_root_dir/bpm_packages"

0 commit comments

Comments
 (0)