mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-09-21 02:17:11 +00:00
plugins/asdf: Add asdf
extendable version manager plugin (#593)
* plugins: Add asdf plugin * plugins/asdf: Add docs Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
This commit is contained in:
parent
a3ea82a5be
commit
a3720d83b2
8
completions/asdf.completion.sh
Normal file
8
completions/asdf.completion.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#! bash oh-my-bash.module
|
||||
# Bash completion support for the `asdf` command.
|
||||
# Depends on the `asdf` plugin.
|
||||
|
||||
# Only load the completions if the ASDF_DIR variable was set.
|
||||
if [[ ${ASDF_DIR+set} ]]; then
|
||||
. "$ASDF_DIR/completions/asdf.bash"
|
||||
fi
|
@ -26,6 +26,7 @@ By leveraging these plugins, you can streamline your workflow and tackle coding
|
||||
| Plugin | Description |
|
||||
| --------------- | ------------------------------------------------------------------------------------------------------------------- |
|
||||
| ansible | Configuration management tool used to automate the provisioning, configuration, and management of computer systems. |
|
||||
| [asdf](asdf) | [asdf](https://asdf-vm.com) is a tool version manager to allow installing different versions of Node.js, Ruby, Golang, etc.
|
||||
| aws | Tools for interacting with Amazon Web Services (AWS) |
|
||||
| bash-preexec | Tool allowing execution of commands before they are executed in Bash. |
|
||||
| bashmarks | Utility facilitating directory navigation via bookmarks in Bash. |
|
||||
|
29
plugins/asdf/README.md
Normal file
29
plugins/asdf/README.md
Normal file
@ -0,0 +1,29 @@
|
||||
# asdf plugin
|
||||
|
||||
Add [oh-my-bash](https://ohmybash.github.io) integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.
|
||||
|
||||
## Installation
|
||||
|
||||
1. [Install asdf](https://github.com/asdf-vm/asdf#setup) by running the following:
|
||||
``` bash
|
||||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
|
||||
```
|
||||
|
||||
2. Enable the plugin by adding it to your oh-my-bash `plugins` definition in `~/.bashrc`.
|
||||
``` sh
|
||||
plugins=(asdf)
|
||||
```
|
||||
|
||||
2. Enable the completions by adding it to your oh-my-bash `completions` definition in `~/.bashrc`.
|
||||
``` sh
|
||||
completions=(asdf)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
See the [asdf usage documentation](https://github.com/asdf-vm/asdf#usage) for information on how to use asdf:
|
||||
|
||||
``` bash
|
||||
asdf plugin add nodejs
|
||||
asdf install nodejs latest
|
||||
```
|
35
plugins/asdf/asdf.plugin.sh
Normal file
35
plugins/asdf/asdf.plugin.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#! bash oh-my-bash.module
|
||||
# asdf.plugin.sh: asdf plugin for oh-my-bash.
|
||||
# Author: @RobLoach (https://github.com/robloach)
|
||||
# Author: @prodrigues1912 (https://github.com/prodrigues1912)
|
||||
# Originally suggested in https://github.com/ohmybash/oh-my-bash/pull/310
|
||||
# Fork of the oh-my-zsh asdf plugin
|
||||
|
||||
# Custom ASDF_DIR location
|
||||
if [[ ${ASDF_DIR+set} ]]; then
|
||||
. "$ASDF_DIR/asdf.sh"
|
||||
|
||||
# Home
|
||||
elif [[ -f "$HOME/.asdf/asdf.sh" ]]; then
|
||||
ASDF_DIR="$HOME/.asdf"
|
||||
. "${ASDF_DIR}/asdf.sh"
|
||||
|
||||
# Config
|
||||
elif [[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/asdf/asdf.sh" ]]; then
|
||||
ASDF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/asdf"
|
||||
. "${ASDF_DIR}/asdf.sh"
|
||||
|
||||
# Arch Linux / AUR Package
|
||||
elif [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
|
||||
ASDF_DIR="/opt/asdf-vm"
|
||||
. /opt/asdf-vm/asdf.sh
|
||||
|
||||
# Homebrew
|
||||
elif _omb_util_command_exists brew; then
|
||||
_omb_plugin_asdf__prefix="$(brew --prefix asdf)"
|
||||
if [[ -f "$_omb_plugin_asdf__prefix/libexec/asdf.sh" ]]; then
|
||||
ASDF_DIR="$_omb_plugin_asdf__prefix/libexec"
|
||||
. "$ASDF_DIR/asdf.sh"
|
||||
fi
|
||||
unset -v _omb_plugin_asdf__prefix
|
||||
fi
|
Loading…
Reference in New Issue
Block a user