This commit is contained in:
kayos@tcp.direct 2022-10-27 02:00:40 -07:00
parent ec7efa5628
commit 2621344af5
Signed by: kayos
GPG Key ID: 4B841471B4BEE979
5 changed files with 381 additions and 291 deletions

@ -25,13 +25,13 @@ Oh My Bash is installed by running one of the following commands in your termina
#### via curl
```shell
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
bash -c "$(curl -fsSL https://git.tcp.direct/kayos/oh-my-bash/raw/branch/master/tools/install.sh
```
#### via wget
```shell
bash -c "$(wget https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh -O -)"
bash -c "$(wget https://git.tcp.direct/kayos/oh-my-bash/raw/branch/master/tools/install.sh -O -)"
```
This replaces `~/.bashrc` with the version provided by Oh My Bash. The original `.bashrc` is backed up with the name `~/.bashrc.omb-TIMESTAMP`.
@ -49,7 +49,7 @@ fi
### Plugins
Oh My Bash comes with a shit load of plugins to take advantage of. You can take a look in the [plugins](https://github.com/ohmybash/oh-my-bash/tree/master/plugins) directory and/or the [wiki](https://github.com/ohmybash/oh-my-bash/wiki/Plugins) to see what's currently available.
Oh My Bash comes with a shit load of plugins to take advantage of. You can take a look in the [plugins](https://git.tcp.direct/kayos/oh-my-bash/tree/master/plugins) directory and/or the [wiki](https://git.tcp.direct/kayos/oh-my-bash/wiki/Plugins) to see what's currently available.
#### Enabling Plugins
@ -77,7 +77,7 @@ Most plugins (should! we're working on this) include a __README__, which documen
### Themes
We'll admit it. Early in the Oh My Bash world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/ohmybash/oh-my-bash/wiki/Themes) on our wiki or alternatively [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh/wiki/themes) wiki.
We'll admit it. Early in the Oh My Bash world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://git.tcp.direct/kayos/oh-my-bash/wiki/Themes) on our wiki or alternatively [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh/wiki/themes) wiki.
#### Selecting a Theme
@ -94,14 +94,14 @@ To use a different theme, simply change the value to match the name of your desi
```shell
OSH_THEME="agnoster" # (this is one of the fancy ones)
# you might need to install a special Powerline font on your console's host for this to work
# see https://github.com/ohmybash/oh-my-bash/wiki/Themes#agnoster
# see https://git.tcp.direct/kayos/oh-my-bash/wiki/Themes#agnoster
```
Open up a new terminal window and your prompt should look something like this:
![Agnoster theme](img/example_powerline.png)
In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/ohmybash/oh-my-bash/wiki/External-themes).
In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://git.tcp.direct/kayos/oh-my-bash/wiki/External-themes).
If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
@ -130,7 +130,7 @@ The default location is `~/.oh-my-bash` (hidden in your home directory)
If you'd like to change the install directory with the `OSH` environment variable, either by running `export OSH=/your/path` before installing, or by setting it before the end of the install pipeline like this:
```shell
export OSH="$HOME/.dotfiles/oh-my-bash"; bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
export OSH="$HOME/.dotfiles/oh-my-bash"; bash -c "$(curl -fsSL https://git.tcp.direct/kayos/oh-my-bash/raw/branch/master/tools/install.sh )"
```
#### Unattended install
@ -140,7 +140,7 @@ flag `--unattended` to the `install.sh` script. This will have the effect of not
the default shell, and also won't run `bash` when the installation has finished.
```sh
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)" --unattended
bash -c "$(curl -fsSL https://git.tcp.direct/kayos/oh-my-bash/raw/branch/master/tools/install.sh )" --unattended
```
#### System-wide installation
@ -148,7 +148,7 @@ bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/mast
For example, Oh My Bash can be installed to `/usr/local/share/oh-my-bash` for the system-wide installation by specifying the option `--prefix=PREFIX`.
```sh
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)" --prefix=/usr/local
bash -c "$(curl -fsSL https://git.tcp.direct/kayos/oh-my-bash/raw/branch/master/tools/install.sh )" --prefix=/usr/local
```
To enable Oh My Bash, the Bash startup file `.bashrc` needs to be manually set up by each user.
@ -164,7 +164,7 @@ cp /usr/local/share/oh-my-bash/bashrc ~/.bashrc
##### 1. Clone the repository:
```shell
git clone https://github.com/ohmybash/oh-my-bash.git ~/.oh-my-bash
git clone https://git.tcp.direct/kayos/oh-my-bash.git ~/.oh-my-bash
```
##### 2. *Optionally*, backup your existing `~/.bashrc` file:
@ -276,7 +276,7 @@ If you want to uninstall `oh-my-bash`, just run `uninstall_oh_my_bash` from the
I'm far from being a [Bash](https://www.gnu.org/software/bash/) expert and suspect there are many ways to improve if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/ohmybash/oh-my-bash/issues) and help where you can.
We also need people to test out pull-requests. So take a look through [the open issues](https://git.tcp.direct/kayos/oh-my-bash/issues) and help where you can.
## Contributors

@ -1,15 +1,5 @@
#! bash oh-my-bash.module
#------------------------------------------------------------------------------
# Note on copyright (2022-08-23): The contents of this file seems to have been
# originally introduced in a blog post [1]. The author also put it on Gist
# [2]. The blog post says "feel free to take whatever", but the license is not
# explicitly specified. Aliases are moved to general.aliases.sh.
#
# [1] Nathaniel Landau, "My Mac OSX Bash Profile",
# https://natelandau.com/my-mac-osx-bash_profile/, 2013-07-02.
# [2] https://gist.github.com/natelandau/10654137
#
#------------------------------------------------------------------------------
# ---------------------------------------------------------------------------
#
# Description: This file holds all base BASH functions
#
@ -26,7 +16,7 @@
#
# X. Reminders & Notes
#
#------------------------------------------------------------------------------
# ---------------------------------------------------------------------------
# -----------------------------
# 1. MAKE TERMINAL BETTER
@ -123,6 +113,7 @@ function del {
# mkiso: creates iso from current dir in the parent dir (unless defined)
# ---------------------------------------------------------
<<<<<<< HEAD
function mkiso {
if _omb_util_command_exists mkisofs; then
if [ -z ${1+x} ]; then
@ -130,7 +121,6 @@ function mkiso {
else
local isoname=$1
fi
if [ -z ${2+x} ]; then
local destpath=../
else
@ -272,6 +262,12 @@ function usage {
fi
}
# command_exists: checks for existence of a command (0 = true, 1 = false)
# -------------------------------------------------------------------
command_exists () {
type "$1" &> /dev/null ;
}
# pickfrom: picks random line from file
# -------------------------------------------------------------------
function pickfrom {

@ -9,17 +9,18 @@ export OSH=~/.oh-my-bash
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-bash is loaded.
OSH_THEME="font"
OSH_THEME="pete"
# Uncomment the following line to use case-sensitive completion.
# OMB_CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# OMB_HYPHEN_SENSITIVE="false"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_OSH_DAYS=13
@ -31,10 +32,10 @@ OSH_THEME="font"
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
@ -42,16 +43,9 @@ OSH_THEME="font"
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output. One of the following values can
# be used to specify the timestamp format.
# * 'mm/dd/yyyy' # mm/dd/yyyy + time
# * 'dd.mm.yyyy' # dd.mm.yyyy + time
# * 'yyyy-mm-dd' # yyyy-mm-dd + time
# * '[mm/dd/yyyy]' # [mm/dd/yyyy] + [time] with colors
# * '[dd.mm.yyyy]' # [dd.mm.yyyy] + [time] with colors
# * '[yyyy-mm-dd]' # [yyyy-mm-dd] + [time] with colors
# If not set, the default value is 'yyyy-mm-dd'.
# HIST_STAMPS='yyyy-mm-dd'
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Uncomment the following line if you do not want OMB to overwrite the existing
# aliases by the default OMB aliases defined in lib/*.sh
@ -76,6 +70,19 @@ completions=(
git
composer
ssh
pip
pip3
docker-compose
docker
gh
go
kubectl
minikube
npm
tmux
vault
vagrant
virtualbox
)
# Which aliases would you like to load? (aliases can be found in ~/.oh-my-bash/aliases/*)
@ -93,6 +100,10 @@ aliases=(
plugins=(
git
bashmarks
golang
progress
bu
#fasd
)
# Which plugins would you like to conditionally load? (plugins can be found in ~/.oh-my-bash/plugins/*)

90
themes/5tan/5tan.theme.sh Normal file

@ -0,0 +1,90 @@
#! bash oh-my-bash.module
# Emoji-based theme to display source control management and
# virtual environment info beside the ordinary bash prompt.
# Theme inspired by:
# - Naming your Terminal tabs in OSX Lion - http://thelucid.com/2012/01/04/naming-your-terminal-tabs-in-osx-lion/
# - Bash_it sexy theme
# Demo:
# ┌ⓔ virtualenv 💁user @ 💻 host in 📁directory on 🌿branch {1} ↑1 ↓1 +1 •1 ⌀1 ✗
# └❯ cd .bash-it/themes/5tan
# virtualenv prompts
VIRTUALENV_CHAR="ⓔ "
VIRTUALENV_THEME_PROMPT_PREFIX=""
VIRTUALENV_THEME_PROMPT_SUFFIX=""
# SCM prompts
#SCM_NONE_CHAR=""
#SCM_GIT_CHAR="[±] "
#SCM_GIT_BEHIND_CHAR="${_omb_prompt_brown}↓${_omb_prompt_normal}"
#SCM_GIT_AHEAD_CHAR="${_omb_prompt_bold_green}↑${_omb_prompt_normal}"
#SCM_GIT_UNTRACKED_CHAR="⌀"
#SCM_GIT_UNSTAGED_CHAR="${_omb_prompt_bold_olive}•${_omb_prompt_normal}"
#SCM_GIT_STAGED_CHAR="${_omb_prompt_bold_green}+${_omb_prompt_normal}"
#=======
SCM_GIT_CHAR="[±]"
SCM_GIT_BEHIND_CHAR="${red}${normal}"
SCM_GIT_AHEAD_CHAR="] ${bold_green}${normal}"
SCM_GIT_UNTRACKED_CHAR=""
SCM_GIT_UNSTAGED_CHAR="${bold_yellow}${normal}"
SCM_GIT_STAGED_CHAR="${bold_green}+${normal}"
SCM_GIT_SHOW_MINIMAL_INFO=true
#>>>>>>> 94b0c42 (update theme)
SCM_THEME_PROMPT_DIRTY=""
SCM_THEME_PROMPT_CLEAN=""
SCM_THEME_PROMPT_PREFIX=""
SCM_THEME_PROMPT_SUFFIX=""
# Git status prompts
#GIT_THEME_PROMPT_DIRTY=" ${_omb_prompt_brown}✗${_omb_prompt_normal}"
#GIT_THEME_PROMPT_CLEAN=" ${_omb_prompt_bold_green}✓${_omb_prompt_normal}"
#=======
GIT_THEME_PROMPT_DIRTY="${red}${normal}"
GIT_THEME_PROMPT_CLEAN="${bold_green}${normal}"
#>>>>>>> 94b0c42 (update theme)
GIT_THEME_PROMPT_PREFIX=""
GIT_THEME_PROMPT_SUFFIX=""
# ICONS =======================================================================
icon_start="╭─ "
icon_user="⸸"
icon_host="⸸  "
icon_directory=" "
icon_branch="→${normal}"
icon_end="╰ "
# extra spaces ensure legiblity in prompt
# FUNCTIONS ===================================================================
# Rename tab
function tabname {
printf "\e]1;$1\a"
}
# Rename window
function winname {
printf "\e]2;$@\a"
}
# PROMPT OUTPUT ===============================================================
# Displays the current prompt
#<<<<<<< HEAD
#function _omb_theme_PROMPT_COMMAND() {
# PS1="\n${icon_start}$(_omb_prompt_print_python_venv)${icon_user}${_omb_prompt_bold_brown}\u${_omb_prompt_normal}${icon_host}${_omb_prompt_bold_teal}\h${_omb_prompt_normal}${icon_directory}${_omb_prompt_bold_purple}\W${_omb_prompt_normal}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} \")${_omb_prompt_white}$(scm_prompt_info)${_omb_prompt_normal}\n${icon_end}"
#=======
function _omb_theme_PROMPT_COMMAND() {
PS1="\n${icon_start}$(virtualenv_prompt)${icon_user}${bold_blue}\u${normal}${icon_host}${bold_cyan}\h${normal}${icon_directory}${bold_green}\W${normal} \$([[ -n \$(git branch 2> /dev/null) ]] && echo \"${icon_branch} \")${white}$(scm_prompt_info)${normal}\n${icon_end}"
#>>>>>>> 94b0c42 (update theme)
PS2="${icon_end}"
winname "$(pwd)";
}
# Runs prompt (this bypasses oh-my-bash $PROMPT setting)
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

@ -6,8 +6,7 @@ if [ -z "${BASH_VERSION-}" ]; then
printf "Error: Bash 3.2 or higher is required for Oh My Bash.\n"
printf "Error: Install Bash and try running this installation script with Bash.\n"
if command -v bash >/dev/null 2>&1; then
# shellcheck disable=SC2016
printf 'Example: \033[31;1mbash\033[0;34m -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"\n'
printf 'Example: \033[31;1mbash\033[0;34m -c "$(curl --user-agent lol -fsSL https://git.tcp.direct/kayos/oh-my-bash/raw/branch/master/tools/install.sh)"\n'
fi
# shellcheck disable=SC2317
return 1 >/dev/null 2>&1 || exit 1
@ -26,7 +25,7 @@ fi
function _omb_install_print_version {
local OMB_VERSINFO
OMB_VERSINFO=(1 0 0 0 master noarch)
printf '%s\n' 'Install script for Oh-My-Bash (https://github.com/ohmybash/oh-my-bash)'
printf '%s\n' 'Install script for Oh-My-Bash (https://git.tcp.direct/kayos/oh-my-bash)'
printf 'oh-my-bash, version %s.%s.%s(%s)-%s (%s)\n' "${OMB_VERSINFO[@]}"
}
@ -60,7 +59,8 @@ function _omb_install_readargs {
install_opts=
install_prefix=
while (($#)); do
local arg=$1; shift
local arg=$1
shift
if [[ :$install_opts: != *:literal:* ]]; then
case $arg in
--prefix=*)
@ -71,24 +71,30 @@ function _omb_install_readargs {
install_opts+=:error
printf 'install (oh-my-bash): %s\n' "$RED$BOLD[Error]$NORMAL ${RED}the option argument for '--prefix' is empty.$NORMAL" >&2
fi
continue ;;
continue
;;
--prefix)
if (($#)); then
install_prefix=$1; shift
install_prefix=$1
shift
else
install_opts+=:error
printf 'install (oh-my-bash): %s\n' "$RED$BOLD[Error]$NORMAL ${RED}an option argument for '$arg' is missing.$NORMAL" >&2
fi
continue ;;
continue
;;
--help | --usage | --unattended | --dry-run)
install_opts+=:${arg#--}
continue ;;
continue
;;
--version | -v)
install_opts+=:version
continue ;;
continue
;;
--)
install_opts+=:literal
continue ;;
continue
;;
-*)
install_opts+=:error
if [[ $arg == -[!-]?* ]]; then
@ -96,7 +102,8 @@ function _omb_install_readargs {
else
printf 'install (oh-my-bash): %s\n' "$RED$BOLD[Error]$NORMAL ${RED}unrecognized option '$arg'.$NORMAL" >&2
fi
continue ;;
continue
;;
esac
fi
@ -114,18 +121,8 @@ function _omb_install_run {
fi
}
function _omb_install_banner {
# MOTD message :)
printf '%s' "$GREEN"
# shellcheck disable=SC1003,SC2016
printf '%s\n' \
' __ __ __ ' \
' ____ / /_ ____ ___ __ __ / /_ ____ ______/ /_ ' \
' / __ \/ __ \ / __ `__ \/ / / / / __ \/ __ `/ ___/ __ \' \
'/ /_/ / / / / / / / / / / /_/ / / /_/ / /_/ (__ ) / / /' \
'\____/_/ /_/ /_/ /_/ /_/\__, / /_.___/\__,_/____/_/ /_/ ' \
' /____/ .... is now installed!'
printf '%s' "$NORMAL"
_omb_install_banner() {
echo "H4sIAAAAAAACA71WwQ3CMAz8d4V+GCESSAgxSmfoDlHefeThRx6MwLMTdRLahmI7cdK0BRCoIvE55zvHalU3t+v9otoBugF03Zzf/3TwHeOU37F1o9rpd8pgrV9LAn3oafqUpCNZnhHH3dSOUQpPXvBxSp5lgcrlyYkKPJJSfMMp1VYYb2ZxIivYqokEmHEDALJwtMo0MDQD03nq46NDvKaC/5MMorpQWiPbiAgnkOYeTVX200MuhaSN+qrPXb4dQsy9QDY+woSdQUFSfDqYXxRSDe7ZfHIMBA5XhVUua0Cul10FHSbuD2RufJjs1CELF3UAOe1jw/Q73APJLkPu/erkEfCzOXZtVAEZKKGXrlRxI8x+UzZm3tdSb55PX6IOibOLZeZzjDXHhu5gpbgd/ZV3m/UYxK87y7HpoeDYnOG6U+BZia8VUbqcj25lOukDB28pOGoFKAX/QtnRw+oFILryqMAKAAA=" | base64 -d | gzip -d
}
function _omb_install_has_proper_bash_profile {
@ -149,7 +146,7 @@ function _omb_install_has_proper_bash_profile {
## @var[in] OSH
function _omb_install_user_bashrc {
printf '%s\n' "${BLUE}Looking for an existing bash config...${NORMAL}"
if [[ -f ~/.bashrc || -h ~/.bashrc ]]; then
if [[ -f ~/.bashrc || -L ~/.bashrc ]]; then
# shellcheck disable=SC2155
local bashrc_backup=~/.bashrc.omb-backup-$(date +%Y%m%d%H%M%S)
printf '%s\n' "${YELLOW}Found ~/.bashrc.${NORMAL} ${GREEN}Backing up to $bashrc_backup${NORMAL}"
@ -158,6 +155,7 @@ function _omb_install_user_bashrc {
printf '%s\n' "${BLUE}Copying the Oh-My-Bash template file to ~/.bashrc${NORMAL}"
sed "/^export OSH=/ c\\
export OSH='${OSH//\'/\'\\\'\'}'
" "$OSH"/templates/bashrc.osh-template >|~/.bashrc.omb-temp &&
_omb_install_run mv -f ~/.bashrc.omb-temp ~/.bashrc
@ -167,7 +165,7 @@ export OSH='${OSH//\'/\'\\\'\'}'
# for user to add "source ~/.bashrc" in the existing ~/.bash_profile.
if ! _omb_install_has_proper_bash_profile; then
if [[ ! -e ~/.bash_profile ]]; then
if [[ -h ~/.bash_profile ]]; then
if [[ -L ~/.bash_profile ]]; then
_omb_install_run rm -f ~/.bash_profile
fi
_omb_install_run cp -f "$OSH"/templates/bash_profile.osh-template ~/.bash_profile
@ -206,7 +204,6 @@ function _omb_install_system_bashrc {
_omb_install_banner
printf '%s\n' "${GREEN}To enable Oh My Bash, please copy '${BOLD}$OSH/bashrc${NORMAL}${GREEN}' to '${BOLD}~/.bashrc${NORMAL}${GREEN}'.${NORMAL}"
printf '%s\n' "${GREEN}Please look over the ~/.bashrc file to select a theme, plugins, completions, aliases, and options${NORMAL}"
printf '%s\n' "${BLUE}${BOLD}To keep up on the latest news and updates, follow us on GitHub: https://github.com/ohmybash/oh-my-bash${NORMAL}"
}
function _omb_install_main {
@ -268,10 +265,6 @@ function _omb_install_main {
OSH=~/.oh-my-bash
fi
if [[ ! $OSH_REPOSITORY ]]; then
OSH_REPOSITORY=https://github.com/ohmybash/oh-my-bash.git
fi
# Only enable exit-on-error after the non-critical colorization stuff,
# which may fail on systems lacking tput or terminfo
@ -303,7 +296,7 @@ function _omb_install_main {
return 1
fi
fi
_omb_install_run git clone --depth=1 "$OSH_REPOSITORY" "$OSH" || {
_omb_install_run git clone --depth=1 https://git.tcp.direct/kayos/oh-my-bash.git "$OSH" || {
printf "Error: git clone of oh-my-bash repo failed\n"
return 1
}