Skip to content

Instantly share code, notes, and snippets.

@davidpfarrell
Created November 5, 2019 18:44
Show Gist options
  • Save davidpfarrell/f437a0e5fd905ca58d0148f067bd28d4 to your computer and use it in GitHub Desktop.
Save davidpfarrell/f437a0e5fd905ca58d0148f067bd28d4 to your computer and use it in GitHub Desktop.
Export Bash-It Components as a Series of 'Enable' Commands
#!/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
@rickrussell
Copy link

This works really well for me, also added to backup scripts easily: ~/.dotfile-scripts/backup-bashit.sh > Backup/bash_it-enabled.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment