bag is a bash package and plugin manager which inspired by vim-plug.
- Basic packges and plugins management: install, update or uninstall.
- Customizable to support different downloader: local repos, git repos or cloud drive repos.
bash
4.2 or latergit
$ git clone https://github.com/ishbguy/bag /path/to/bag
or
$ curl -fLo /path/to/bag.sh --create-dirs \
https://raw.githubusercontent.com/ishbguy/bag/master/bag.sh
The only action you need to do is to add below instruction in your bash config file: ~/.bashrc
or ~/.bash_profile
:
[[ -f /path/to/bag.sh ]] && source /path/to/bag.sh
After login bash
, you can use bag
command to manage packges and plugins. bag help
will print usage.
bag v1.0.0
bag <subcmd> [somthing]
subcmds:
base <path> change bags' download directory
edit edit bag list
help show help message, like this output
install [dl:url] install a bag
link <path> <dl:url> add an existed package or repo by symbolic link
list list installed bags
load load all plugins and update PATH
plug <dl:url> add a bag plugin
proxy proxy an package or repo operation cmd
uninstall <dl:url> uninstall a bag
unlink <dl:url> unlink a bag, just like uninstall
update [pat] update one or more bags
version show version number
<dl:url> like 'gh:ishbguy/bag' means that it will install or update bag
from https://github.com/ishbguy/bag by github downloader.
downloaders:
file alias for local downloader
gh alias for github downloader
git downloader for git repo
github downloader for github repo
link downloader for local file or directory as symbolic link
local downloader for local file or directory
bag proxy usage:
bag proxy <action> [args..]
actions:
add <cmd> add a proxy cmd, need to be quoted
del <cmd-pat> delete a proxy cmd, need to be quoted
run [cmd-pat] run all or a pattern matched proxy cmd
edit edit the proxy file
list list all added proxy cmd
help print the bag proxy help message like this
This program is released under the terms of MIT License.
Get more infomation from <https://github.com/ishbguy/bag>.
- Use bag like other package management tools:
bag install gh:ishbguy/bag
bag update gh:ihsbguy/bag
bag uninstall gh:ishbguy/bag
- Use bag as a plugin management tool, you need to add instructions to
~/.bashrc
or~/.bash_profile
:
bag base $HOME/.bags
bag plug gh:ishbguy/bag
bag install
bag load
- Define your own
bag_downloader_XXX
# Define your own github downloader
bag_downloader_github() {
__bag_require git || return 1
# get two args
local bag_opt="$1"
local bag_url="https://github.com/${2#*:}"
local bag=$(__bag_get_bag_name "$bag_url")
# implement the install and update operations
case $bag_opt in
install) git clone "$bag_url" "$BAG_BASE_DIR/$bag" ;;
update) (cd "$BAG_BASE_DIR/$bag" && git pull) ;;
*) __bag_error "No such option: $bag_opt" ;;
esac
}
# Write the help message, then install it
BAG_DOWNLOADER_HELP[github]="downloader for github repo"
BAG_DOWNLOADER[github]="bag_downloader_github"
The default BAG_BASE_DIR
is $HOME/.bags
, you can change it by bag base <dir-path>
or export BAG_BASE_DIR=$DIR_PATH
.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Released under the terms of MIT License.