|
1 | 1 | # bpm
|
2 | 2 |
|
3 |
| -Originally a fork of [bpm](https://github.com/bpmpm/bpm), `bpm` is a package manager for Bash repositories. |
| 3 | +`bpm` is the ultimate Bash (and Zsh, Fish, etc.) Package Manager |
4 | 4 |
|
5 |
| -> Instead of looking for specific install instructions for each package and messing with your path, [bpm] will create a central location for all packages and manage their binaries for you |
| 5 | +--- |
6 | 6 |
|
7 |
| -More specifically, when `bpm` is given a repository to install, it will automatically |
| 7 | +`bpm` is a fork of [basher](https://github.com/basherpm/basher) that adds a _ton_ of new functionality. It makes it significantly easier to install Bash, Zsh, etc. projects to your computer. Often, these projects / scripts are _not_ available through official `apt`, `DNF`, `pacman` repositories, or even from unofficial sources like third party apt repositories or the [AUR](https://aur.archlinux.org) |
8 | 8 |
|
9 |
| -- Detect shell-specific completion scripts, and symlink them to a common directory |
10 |
| -- Detect executable scripts and symlink them to a common directory |
11 |
| -- Detect man pages and symlink them to a common directory |
12 |
| - |
13 |
| -Since the completions and executables are in a common directory, it's much easier to make PATH / completion modifications |
14 |
| - |
15 |
| -## Alternatives Comparison |
16 |
| - |
17 |
| -### Compared to `bpkg`, `bpm` |
18 |
| - |
19 |
| -- Can install multiple packages at once |
20 |
| -- Does not use a `package.json` that clobbers with NPM's |
21 |
| -- Does not automatically invoke `make install` commands on your behalf |
22 |
| -- Probably is able to install more repositories (not verified) |
23 |
| -- Respects XDG |
24 |
| -- Is likely faster |
25 |
| - |
26 |
| -### Compared to `bpm`, `bpm` |
27 |
| - |
28 |
| -- Can install multiple packages at once |
29 |
| -- Has an improved help output |
30 |
| -- Prints why a command failed (rather than just showing the help menu) |
31 |
| -- Has more modern code |
32 |
| -- Better bpm completion scripts |
33 |
| -- Is faster (less exec'ing Bash processes and subshell creations) |
34 |
| -- Does not source `package.sh` which allows for arbitrary command execution |
35 |
| -- More flexible parsing of command line arguments |
36 |
| - |
37 |
| -Even though it is called bpm, it also works with zsh and fish. |
38 |
| - |
39 |
| -## Installation |
40 |
| - |
41 |
| -STATUS: IN DEVELOPMENT |
42 |
| - |
43 |
| -`bpm` requires `bash >= 4`, and the `realpath` utility from `coreutils`. On |
44 |
| -osx you can install both with brew: |
| 9 | +Let's say you want to install [rupa/z](https://github.com/rupa/z), [tj/git-extras](https://github.com/tj/git-extras), [aristocratos/bashtop](https://github.com/aristocratos/bashtop), and [JosefZIla/bash2048](https://github.com/JosefZIla/bash2048). Simply run the following (as you can see, many formats are supported) |
45 | 10 |
|
46 | 11 | ```sh
|
47 |
| -brew install bash coreutils |
| 12 | +$ bpm install \ |
| 13 | + rupa/z \ |
| 14 | + github.com/tj/git-extras \ |
| 15 | + https://github.com/aristocratos/bashtop \ |
| 16 | + git@github.com:JosefZIla/bash2048 |
48 | 17 | ```
|
49 | 18 |
|
50 |
| -1. Clone `bpm`` |
| 19 | +This symlinks all executable scripts to a common directory. It does this for completion files and man pages as well |
51 | 20 |
|
52 | 21 | ```sh
|
53 |
| -git clone https://github.com/bpmpm/bpm "${XDG_DATA_HOME:-$HOME/.local/share}/bpm/source" |
| 22 | +$ 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 |
| 27 | +... |
54 | 28 | ```
|
55 | 29 |
|
56 |
| -2. Initialize `bpm` in your shell initialization |
57 |
| - |
58 |
| -For `bash`, `zsh`, `sh` |
| 30 | +If you want to automatically add the bin directory to your path, source the completion files, and add the man pages to your man path, simply add a two-liner in your shell configuration |
59 | 31 |
|
60 | 32 | ```sh
|
61 | 33 | export PATH="${XDG_DATA_HOME:-$HOME/.local/share}/bpm/source/pkg/bin:$PATH"
|
62 | 34 | eval "$(bpm init bash)" # replace 'bash' with your shell
|
63 | 35 | ```
|
64 | 36 |
|
65 |
| -For `fish` |
66 |
| - |
67 |
| -```fish |
68 |
| -set -gx PATH "${XDG_DATA_HOME:-$HOME/.local/share}/bpm/source/pkg/bin" $PATH |
69 |
| -status --is-interactive; and . (bpm init fish | psub) |
70 |
| -``` |
71 |
| - |
72 |
| -## Updating |
73 |
| - |
74 |
| -Go to the directory where you cloned bpm and pull the latest changes |
75 |
| - |
76 |
| -```sh |
77 |
| -cd "${XDG_DATA_HOME:-$HOME/.local/share}/bpm/source" |
78 |
| -git pull |
79 |
| -``` |
80 |
| - |
81 |
| -## Usage |
82 |
| - |
83 |
| -### Installing packages from Github |
| 37 | +See [Getting Started](./docs/getting-started.md) for more details |
84 | 38 |
|
85 |
| -```sh |
86 |
| -bpm install sstephenson/bats |
87 |
| -``` |
88 |
| - |
89 |
| -This will install [Bats](https://github.com/sstephenson/bats) and add its `./bin` to the `PATH`. |
90 |
| - |
91 |
| -### Installing packages from other sites |
92 |
| - |
93 |
| -```sh |
94 |
| -bpm install bitbucket.org/user/repo_name |
95 |
| -``` |
96 |
| - |
97 |
| -This will install `repo_name` from https://bitbucket.org/user/repo_name |
98 |
| - |
99 |
| -### Installing a local package |
100 |
| - |
101 |
| -If you develop a package locally and want to try it through Basher, |
102 |
| -use the `link` subcommand |
103 |
| - |
104 |
| -```sh |
105 |
| -bpm link ./directory my_namespace/my_package |
106 |
| -``` |
107 |
| - |
108 |
| -The `link` command will install the dependencies of the local package. |
109 |
| -You can prevent that with the `--no-deps` option |
110 |
| - |
111 |
| -### Sourcing files from a package into current shell |
| 39 | +## Alternatives Comparison |
112 | 40 |
|
113 |
| -`bpm` provides an `include` function that allows sourcing files into the |
114 |
| -current shell. After installing a package, you can run: |
| 41 | +Why not use `bpkg` or `Basher`? Because `bpm`... |
115 | 42 |
|
116 |
| -```sh |
117 |
| -include username/repo lib/file.sh |
118 |
| -``` |
119 |
| - |
120 |
| -## Contributing |
| 43 | +- Can install multiple packages at once |
| 44 | +- Does not use a `package.json` that clobbers with NPM's `package.json` (bpkg) |
| 45 | +- Does not automatically invoke `make` commands on your behalf (bpkg) |
| 46 | +- Does not automatically source a `package.sh` for package configuration (basher) |
| 47 | +- Is able to install more repositories |
| 48 | +- Respects the XDG Base Directory specification (bpkg) |
| 49 | +- Is faster (bpm considers exec and subshell creation overhead) |
| 50 | +- Has a _much_ improved help output (basher) |
| 51 | +- Prints why a command failed, rather than just printing the help menu (basher) |
| 52 | +- Has actually been updated recently |
| 53 | +- Better bpm completion scripts |
| 54 | +- More flexibly parses command line arguments (basher) |
121 | 55 |
|
122 |
| -```sh |
123 |
| -git clone https://github.com/eankeen/bpm |
124 |
| -cd bpm |
125 |
| -git submodule update --init |
126 |
| -make test |
127 |
| -``` |
| 56 | +I originally created a [different](https://github.com/eankeen/shell-installer) Shell package manager but later abandoned it. When I _really_ needed the functionality, I forked Basher because it had an excellent test suite and its behavior for installing packages actually made sense, compared to `bpkg` |
0 commit comments