2023-08-08 00:06:49 -07:00
|
|
|
---
|
|
|
|
title: Bash It!
|
|
|
|
description: Ensures Bash is configured to use Bash It!
|
|
|
|
sidebar_label: 94 Bash It!
|
|
|
|
slug: /scripts/after/run_onchange_after_94-bash-it.sh.tmpl
|
|
|
|
githubLocation: https://github.com/megabyte-labs/install.doctor/blob/master/home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl
|
|
|
|
scriptLocation: https://github.com/megabyte-labs/install.doctor/raw/master/home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl
|
|
|
|
repoLocation: home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl
|
|
|
|
---
|
2023-08-30 12:58:51 -07:00
|
|
|
|
2023-08-08 00:06:49 -07:00
|
|
|
# Bash It!
|
|
|
|
|
|
|
|
Ensures Bash is configured to use Bash It!
|
|
|
|
|
|
|
|
## Overview
|
|
|
|
|
|
|
|
This script ensures Bash is configured to use Bash It! It ensures dependencies are installed, installs completions,
|
|
|
|
and enables Bash It! plugins. The completions and plugins are hardcoded in this script.
|
|
|
|
|
|
|
|
## Source Code
|
|
|
|
|
|
|
|
```
|
|
|
|
{{- if (ne .host.distro.family "windows") -}}
|
|
|
|
#!/usr/bin/env -S bash -i
|
|
|
|
# @file Bash It!
|
|
|
|
# @brief Ensures Bash is configured to use Bash It!
|
|
|
|
# @description
|
|
|
|
# This script ensures Bash is configured to use Bash It! It ensures dependencies are installed, installs completions,
|
|
|
|
# and enables Bash It! plugins. The completions and plugins are hardcoded in this script.
|
|
|
|
|
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
|
|
{{ includeTemplate "universal/logg" }}
|
|
|
|
|
|
|
|
### Ensure Powerline is installed
|
|
|
|
if ! command -v powerline > /dev/null; then
|
2023-08-30 12:58:51 -07:00
|
|
|
install-program powerline
|
2023-08-08 00:06:49 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
### Bash-it completions / plugins
|
|
|
|
if command -v powerline > /dev/null && [ -f "$HOME/.bashrc" ]; then
|
2023-11-04 18:46:18 -07:00
|
|
|
logg info 'Running source ~/.bashrc'
|
2023-08-08 00:06:49 -07:00
|
|
|
source ~/.bashrc
|
2023-11-04 18:46:18 -07:00
|
|
|
logg success 'Imported the ~/.bashrc profile'
|
2023-08-08 00:06:49 -07:00
|
|
|
if command -v bash-it > /dev/null; then
|
|
|
|
if [ -n "$BASH_IT" ]; then
|
|
|
|
cd "$BASH_IT" || logg warn "The $BASH_IT directory does not exist"
|
|
|
|
logg info 'Enabling bash-it completions'
|
|
|
|
yes | bash-it enable completion defaults dirs docker docker-compose export git makefile ng npm ssh system vagrant
|
|
|
|
logg info 'Enabling bash-it plugins'
|
|
|
|
yes | bash-it enable plugin base blesh browser cht-sh dirs gitstatus powerline sudo xterm
|
|
|
|
logg info 'Finished enabling bash-it functions'
|
|
|
|
else
|
|
|
|
logg warn 'The BASH_IT variable needs to be defined'
|
|
|
|
fi
|
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg warn 'bash-it is not available'
|
2023-08-08 00:06:49 -07:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
if ! command -v powerline > /dev/null; then
|
2023-11-04 18:46:18 -07:00
|
|
|
logg warn 'powerline is not available'
|
2023-08-08 00:06:49 -07:00
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg warn '~/.bashrc is missing'
|
2023-08-08 00:06:49 -07:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
{{ end -}}
|
|
|
|
```
|