mirror of
https://github.com/tmux-plugins/tpm.git
synced 2024-12-04 18:58:49 +00:00
add branch support
This commit is contained in:
parent
26d9ace1b4
commit
fe5e13152a
@ -26,6 +26,7 @@ set -g @plugin 'tmux-plugins/tmux-sensible'
|
|||||||
|
|
||||||
# Other examples:
|
# Other examples:
|
||||||
# set -g @plugin 'github_username/plugin_name'
|
# set -g @plugin 'github_username/plugin_name'
|
||||||
|
# set -g @plugin 'github_username/plugin_name#branch'
|
||||||
# set -g @plugin 'git@github.com/user/plugin'
|
# set -g @plugin 'git@github.com/user/plugin'
|
||||||
# set -g @plugin 'git@bitbucket.com/user/plugin'
|
# set -g @plugin 'git@bitbucket.com/user/plugin'
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ fi
|
|||||||
clone() {
|
clone() {
|
||||||
local plugin="$1"
|
local plugin="$1"
|
||||||
cd "$(tpm_path)" &&
|
cd "$(tpm_path)" &&
|
||||||
GIT_TERMINAL_PROMPT=0 git clone --recursive "$plugin" >/dev/null 2>&1
|
GIT_TERMINAL_PROMPT=0 git clone -b "$branch" --single-branch --recursive "$plugin" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# tries cloning:
|
# tries cloning:
|
||||||
@ -23,20 +23,22 @@ clone() {
|
|||||||
# 2. expands the plugin name to point to a github repo and tries cloning again
|
# 2. expands the plugin name to point to a github repo and tries cloning again
|
||||||
clone_plugin() {
|
clone_plugin() {
|
||||||
local plugin="$1"
|
local plugin="$1"
|
||||||
clone "$plugin" ||
|
local branch="$2"
|
||||||
clone "https://git::@github.com/$plugin"
|
clone "$plugin" "$branch" ||
|
||||||
|
clone "https://git::@github.com/$plugin" "$branch"
|
||||||
}
|
}
|
||||||
|
|
||||||
# clone plugin and produce output
|
# clone plugin and produce output
|
||||||
install_plugin() {
|
install_plugin() {
|
||||||
local plugin="$1"
|
local plugin="$1"
|
||||||
|
local branch=`[ -z "$2" ] && echo "master" || echo "$2"`
|
||||||
local plugin_name="$(plugin_name_helper "$plugin")"
|
local plugin_name="$(plugin_name_helper "$plugin")"
|
||||||
|
|
||||||
if plugin_already_installed "$plugin"; then
|
if plugin_already_installed "$plugin"; then
|
||||||
echo_ok "Already installed \"$plugin_name\""
|
echo_ok "Already installed \"$plugin_name\""
|
||||||
else
|
else
|
||||||
echo_ok "Installing \"$plugin_name\""
|
echo_ok "Installing \"$plugin_name\""
|
||||||
clone_plugin "$plugin" &&
|
clone_plugin "$plugin" "$branch" &&
|
||||||
echo_ok " \"$plugin_name\" download success" ||
|
echo_ok " \"$plugin_name\" download success" ||
|
||||||
echo_err " \"$plugin_name\" download fail"
|
echo_err " \"$plugin_name\" download fail"
|
||||||
fi
|
fi
|
||||||
@ -45,7 +47,8 @@ install_plugin() {
|
|||||||
install_plugins() {
|
install_plugins() {
|
||||||
local plugins="$(tpm_plugins_list_helper)"
|
local plugins="$(tpm_plugins_list_helper)"
|
||||||
for plugin in $plugins; do
|
for plugin in $plugins; do
|
||||||
install_plugin "$plugin"
|
IFS='#' read -ra plugin <<< "$plugin"
|
||||||
|
install_plugin "${plugin[0]}" "${plugin[1]}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,8 @@ source_plugins() {
|
|||||||
local plugin plugin_path
|
local plugin plugin_path
|
||||||
local plugins="$(tpm_plugins_list_helper)"
|
local plugins="$(tpm_plugins_list_helper)"
|
||||||
for plugin in $plugins; do
|
for plugin in $plugins; do
|
||||||
plugin_path="$(plugin_path_helper "$plugin")"
|
IFS='#' read -ra plugin <<< "$plugin"
|
||||||
|
plugin_path="$(plugin_path_helper "${plugin[0]}")"
|
||||||
silently_source_all_tmux_files "$plugin_path"
|
silently_source_all_tmux_files "$plugin_path"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,8 @@ update_all() {
|
|||||||
echo_ok ""
|
echo_ok ""
|
||||||
local plugins="$(tpm_plugins_list_helper)"
|
local plugins="$(tpm_plugins_list_helper)"
|
||||||
for plugin in $plugins; do
|
for plugin in $plugins; do
|
||||||
local plugin_name="$(plugin_name_helper "$plugin")"
|
IFS='#' read -ra plugin <<< "$plugin"
|
||||||
|
local plugin_name="$(plugin_name_helper "${plugin[0]}")"
|
||||||
# updating only installed plugins
|
# updating only installed plugins
|
||||||
if plugin_already_installed "$plugin_name"; then
|
if plugin_already_installed "$plugin_name"; then
|
||||||
update "$plugin_name" &
|
update "$plugin_name" &
|
||||||
@ -49,7 +50,8 @@ update_all() {
|
|||||||
update_plugins() {
|
update_plugins() {
|
||||||
local plugins="$*"
|
local plugins="$*"
|
||||||
for plugin in $plugins; do
|
for plugin in $plugins; do
|
||||||
local plugin_name="$(plugin_name_helper "$plugin")"
|
IFS='#' read -ra plugin <<< "$plugin"
|
||||||
|
local plugin_name="$(plugin_name_helper "${plugin[0]}")"
|
||||||
if plugin_already_installed "$plugin_name"; then
|
if plugin_already_installed "$plugin_name"; then
|
||||||
update "$plugin_name" &
|
update "$plugin_name" &
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user