Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Pull Request Checklist

<!-- Use this checklist when preparing an urda.bash release via pull request -->

- [ ] Are you the repo owner? `urda.bash` is not accepting outside pull requests at this time.
- [ ] Did you update `URDABASH_VERSION` in `bashrc`? In `VERSION`?
- [ ] Did `make test` pass?
- [ ] Do all files have headers?
- [ ] Did `make copy` get updated (if required)?
- [ ] Did `make diffs` get updated (if required)?
- [ ] Did `make test` get updated (if required)?
8 changes: 5 additions & 3 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ on:

jobs:
make-test:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
# https://github.com/marketplace/actions/checkout
- name: Checkout ⬇️
uses: actions/checkout@v5

- name: urda.bash Testing
- name: urda.bash Testing 🧪
run: make test
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# CHANGELOG

## 1.0.0

- In late 2025, `urda.bash` got a fresh coat of paint.
- `bashrc`
- Introduced `URDABASH_*` variables as `readonly`.
- Setup `XDG` environment variables.
- Cleaned up sourcing with `_source_if_exists`.
- Setup `case` against `uname` result for OS imports.
- Cleaned up `pyenv` import, removed `workon` and `deactivate`. Use `.python-version` to "switch `venvs`.
- `_set_ps1` got a full overhaul. Different "lines" are now functions, and are built in a single `prompt` result.
- `PROMPT_COMMAND` is no longer just replaced with our `ps1` command.
- `urda.bash` can now check GitHub for new versions (requires `curl` or `wget`).
- `bash_aliases`
- Moved `colordiff` up to just `alias diff` setup area.
- Removed `/usr/bin/dircolors` section (for now).
- `bash_exports`
- Moved `CLICOLOR` to `bash_osx`.
- Added `GPG` values.
- `bash_linux`
- Joins the `urda.bash` family for any `Linux` needs.
- `bash_osx`
- Added simple "guard" to top of file.
- Updated `env` variables.
- Cleaned up `brew` and related tooling imports.
- Cleaned up `update_brew` function.
- `Makefile`
- Now supports `make version-check` and will be invoked with `make test` as well.
- `VERSION`
- Version file created for remote version checking.
- GitHub
- Added a `pull_request_template` mostly for tracking releases.
- Updated `testing.yaml` to latest `runs-on` and `actions/checkout
- General, Other
- Added a `LICENSE` file to repo, just set to `MIT`.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Peter Urda

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ DIFF := $(firstword $(shell which colordiff diff))
DIFF_ARGS := -u

SHELLCHECK := $(shell which shellcheck)
SHELLCHECK_ARGS := --shell=bash -e SC1090
SHELLCHECK_ARGS := --shell=bash -e SC1090 -e SC2155
SHELLCHECK_FILES := ./bash*

########################################################################################################################
# Commands
########################################################################################################################


# `make help` needs to be first so it is ran when a bare `make` is called.
.PHONY: help
help: # Show this help screen
@ack '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) |\
sort -k1,1 |\
awk 'BEGIN {FS = ":.*?# "}; {printf "\033[1m%-30s\033[0m %s\n", $$1, $$2}'

########################################################################################################################

.PHONY: copy
copy: # Copy the local bash configs into your home directory (DESTRUCTIVE).
cp ./bashrc ~/.bashrc
cp ./bash_aliases ~/.bash_aliases
cp ./bash_exports ~/.bash_exports
cp ./bash_profile ~/.bash_profile
cp ./bash_linux ~/.bash_linux
cp ./bash_osx ~/.bash_osx


.PHONY: diffs
diffs: # Run a `diff` against your local shell files against this repo's shell files.
@echo "diff ./bashrc ~/.bashrc"
Expand All @@ -45,10 +45,23 @@ diffs: # Run a `diff` against your local shell files against this repo's shell f
@$(DIFF) $(DIFF_ARGS) ./bash_exports ~/.bash_exports || :
@echo "diff ./bash_profile ~/.bash_profile"
@$(DIFF) $(DIFF_ARGS) ./bash_profile ~/.bash_profile || :
@echo "diff ./bash_linux ~/.bash_linux"
@$(DIFF) $(DIFF_ARGS) ./bash_linux ~/.bash_linux || :
@echo "diff ./bash_osx ~/.bash_osx"
@$(DIFF) $(DIFF_ARGS) ./bash_osx ~/.bash_osx || :


.PHONY: test
test: # Test and check shell scripts for issues.
test: version-check # Test and check shell scripts for issues.
$(SHELLCHECK) $(SHELLCHECK_ARGS) $(SHELLCHECK_FILES)

.PHONY: version-check
version-check: # Check the reported version and code version.
@file_ver=$$(cat VERSION); \
var_ver=$$(awk -F\" '/^readonly URDABASH_VERSION=/{print $$2}' bashrc); \
if [ "$$file_ver" = "$$var_ver" ]; then \
echo "VERSION matches '$$var_ver'"; \
exit 0; \
else \
echo "VERSION mismatch: VERSION='$$file_ver', bashrc='$$var_ver'"; \
exit 1; \
fi
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ After you clone this repo, you can also run a quick `diff` that will compare you
```bash
make diffs
```

## Running tests

This will also run a `make version-check`.

```bash
make test
```
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
28 changes: 5 additions & 23 deletions bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
alias clear='printf "\033c"'

# better looking diff
alias diff='diff -u'
if hash colordiff 2>/dev/null; then
alias diff='colordiff -u'
else
alias diff='diff -u'
fi

# get a UUID on demand
alias get_uuid='python3 -c "import uuid;print(uuid.uuid4())"'
Expand All @@ -16,25 +20,3 @@ alias ll='ls -hlFs'

# When using sudo, use alias expansion (otherwise sudo ignores your aliases)
alias sudo='sudo '

# Enable colors for certain commands
if [ -x /usr/bin/dircolors ]; then
if [ -r ~/.dircolors ]; then
eval "$(dircolors -b ~/.dircolors)"
else
eval "$(dircolors -b)"
fi

alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

# If colordiff is available, use it in place of diff
if hash colordiff 2>/dev/null; then
alias diff='colordiff -u'
fi
fi
6 changes: 3 additions & 3 deletions bash_exports
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# shellcheck shell=bash
# ~/.bash_exports: General Exports

# General Settings
export CLICOLOR=YES

# Git Settings
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWSTASHSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true

# GPG
export GPG_TTY="$(tty)"

# History Settings
export HISTCONTROL=ignoreboth
export HISTFILESIZE=2000
Expand Down
1 change: 1 addition & 0 deletions bash_history
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- bash -*-
# shellcheck shell=bash
# ~/.bash_history: Bash command history

# (╯°□°)╯︵ ┻━┻
# You serious ?
10 changes: 10 additions & 0 deletions bash_linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- bash -*-
# shellcheck shell=bash
# ~/.bash_linux: Linux specific modifications and tweaks

[[ $- == *i* ]] || return 0
[[ "$(uname -s)" == "Linux" ]] || return 0

################################################################################
# Linux Environment Variables
################################################################################
119 changes: 51 additions & 68 deletions bash_osx
Original file line number Diff line number Diff line change
@@ -1,89 +1,72 @@
# -*- bash -*-
# shellcheck shell=bash
# ~/.bash_osx: macOS specific settings
# ~/.bash_osx: macOS specific modifications and tweaks

[[ $- == *i* ]] || return 0
[[ "$(uname -s)" == "Darwin" ]] || return 0

################################################################################
# macOS Modifications and Tweaks
# macOS Environment Variables
################################################################################

# Silence notice about `zsh`.
export BASH_SILENCE_DEPRECATION_WARNING=1

# Ignore .DS_Store files in tab complete. See also:
#
# https://apple.stackexchange.com/questions/71398/
# https://apple.stackexchange.com/a/71402/59583
#
export FIGNORE=$FIGNORE:DS_Store

# Ignore .Trash folders
export FIGNORE=$FIGNORE:.Trash

# Fix Pinentry
#
# https://gpgtools.tenderapp.com/discussions/problems/50502-how-to-avoid-pinentry-pop-up-window-when-using-terminal
#
GPG_TTY="$(tty)"
export GPG_TTY
# Enable CLI Colors
export CLICOLOR=YES
# Tab ignores
export FIGNORE=${FIGNORE:+${FIGNORE}:}.DS_Store:.Trash
# GPG Pin Entry CLI setup
export PINENTRY_USER_DATA="USE_CURSES=1"

# Tab complete symlinks. See also:
#
# https://superuser.com/questions/271626/
# https://superuser.com/questions/155167/
# https://superuser.com/a/271677/10121
#
bind 'set mark-symlinked-directories on'

################################################################################
# Homebrew Modifications and Tweaks
# Tooling
################################################################################

# Address "-bash: brew: command not found" on M1 macs
if [[ $(uname -m) == 'arm64' ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# ------------------------------
# Homebrew
# ------------------------------
# urda.bash supports Homebrew on Apple Silicon only.
if [ -x /opt/homebrew/bin/brew ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"

# Hide Homebrew Env Hints
export HOMEBREW_NO_ENV_HINTS=true

brew_prefix="$(brew --prefix 2>/dev/null)"
nvm_prefix="$(brew --prefix nvm 2>/dev/null)"

# Homebrew's sbin fix
export PATH="/usr/local/sbin:$PATH"
# Custom Homebrew updater function
update_brew() {
bold=$(tput bold 2>/dev/null || printf '')
normal=$(tput sgr0 2>/dev/null || printf '')
brew --version &&
echo "${bold} > brew update${normal}" && brew update &&
echo "${bold} > brew upgrade${normal}" && brew upgrade &&
echo "${bold} > brew autoremove${normal}" && brew autoremove &&
echo "${bold} > brew cleanup${normal}" && brew cleanup &&
echo "${bold} > brew doctor${normal}" && brew doctor;
}

# Hide Homebrew Env Hints
export HOMEBREW_NO_ENV_HINTS=true
# ------------------------------
# Homebrew extras
# ------------------------------

# Attempt to load brew - bash completions
if [ -f "$(brew --prefix)/etc/bash_completion" ]; then
# ------------------------------
# NVM (via Homebrew)
# ------------------------------
if [ -n "${nvm_prefix}" ] && [ -f "${nvm_prefix}/nvm.sh" ]; then
# shellcheck source=/dev/null
source "$(brew --prefix)/etc/bash_completion"
fi
source "${nvm_prefix}/nvm.sh"
fi

# Configure NVM
if [ -f "$(brew --prefix nvm)/nvm.sh" ]; then
# ------------------------------
# Bash completions
# ------------------------------
if [ -n "${brew_prefix}" ] && [ -f "${brew_prefix}/etc/bash_completion" ]; then
# shellcheck source=/dev/null
source "$(brew --prefix nvm)/nvm.sh"
fi
source "${brew_prefix}/etc/bash_completion"
fi

# Configure Rust
if [ -d "$(brew --prefix rustup)/bin" ]; then
RUST_BIN="$(brew --prefix rustup)/bin"
export PATH="$PATH:$RUST_BIN"
unset brew_prefix
unset nvm_prefix
fi

################################################################################
# macOS Aliases and Functions
################################################################################

update_brew() {
bold=$(tput bold);
normal=$(tput sgr0);
brew --version &&
echo "${bold} > brew update${normal}" &&
brew update &&
echo "${bold} > brew upgrade${normal}" &&
brew upgrade &&
echo "${bold} > brew autoremove${normal}" &&
brew autoremove &&
echo "${bold} > brew cleanup${normal}" &&
brew cleanup &&
echo "${bold} > brew doctor${normal}" &&
brew doctor;
}
1 change: 1 addition & 0 deletions bash_secrets
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- bash -*-
# shellcheck shell=bash
# ~/.bash_secrets: For storing sensitive settings and variables

# (╯°□°)╯︵ ┻━┻
# You serious ?
Loading