Created
November 5, 2019 18:44
-
-
Save davidpfarrell/f437a0e5fd905ca58d0148f067bd28d4 to your computer and use it in GitHub Desktop.
Export Bash-It Components as a Series of 'Enable' Commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Exports Bash-it components as a series of 'enable' commands. | |
# The output can be saved to a file and sourced as needed to re-enable components. | |
# A 'disable all' statement is present for each component, but commented by default. | |
source "${BASH_IT:?"variable not defined"}"/bash_it.sh | |
components=( alias plugin completion ) | |
echo "# Bash-it Enabled-Component Backup" | |
echo "# Date: $(date)" | |
echo "# Folder: ${BASH_IT}" | |
echo "# Components: ${components[@]}" | |
for component in ${components[@]}; do | |
echo "" | |
echo "# ${component}" | |
echo "" | |
echo "#bash-it disable ${component} all" | |
echo "" | |
for feature in $( bash-it show "${component}" | grep '\[x\]' | awk '{print $1}' | sort ); do | |
echo "bash-it enable ${component} ${feature}"; | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works really well for me, also added to backup scripts easily: ~/.dotfile-scripts/backup-bashit.sh > Backup/bash_it-enabled.sh