From 760a31ceb912af117b86c1c113c261090951e9a4 Mon Sep 17 00:00:00 2001 From: CrimsonTome Date: Sun, 26 Feb 2023 05:02:16 +0000 Subject: [PATCH] chore: more checks + shellcheck stuff --- .talismanrc | 4 ++-- fedora/.bashrc | 21 +++++++++++++-------- fedora/.bashrc.d/.bash_aliases | 24 ++++++++++++------------ 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/.talismanrc b/.talismanrc index 54f781e..d71d79a 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,6 +1,6 @@ fileignoreconfig: - filename: fedora/.bashrc - checksum: 3087a11440cfa2411487525a7d550fe6c42094da451b995854a5b6182a490050 + checksum: 50343b6939422a69285d997490f765d983d739a4f1bfc53d3ae060ed9fb2f45c - filename: fedora/.bashrc.d/.bash_aliases - checksum: 4f80b5ab9620ee36324469c0fb487c5c19ddd7a0c77499c3e4ee28bf498abbfb + checksum: bb0c560b022611bd0cc0dfcd3e0d591dee044835fa713d64e3b677b80ffd08cf version: "1.0" diff --git a/fedora/.bashrc b/fedora/.bashrc index e89a6c0..23bf857 100644 --- a/fedora/.bashrc +++ b/fedora/.bashrc @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # .bashrc # Source global definitions @@ -6,7 +8,7 @@ if [ -f /etc/bashrc ]; then fi # User specific environment -if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]] +if ! [[ "$PATH" =~ "$HOME"/.local/bin:$HOME/bin: ]] then PATH="$HOME/.local/bin:$HOME/bin:$PATH" fi @@ -16,28 +18,31 @@ export HISTSIZE=-1 export HISTFILESIZE=-1 shopt -s histappend -if [ -f $HOME/.bashrc.d/.bash_aliases ] ; then - source $HOME/.bashrc.d/.bash_aliases +if [ -f "$HOME"/.bashrc.d/.bash_aliases ] ; then + source "$HOME"/.bashrc.d/.bash_aliases fi eval "$(starship init bash)" export GPG_TTY=/dev/pts/2 -function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;} export DOTNET_ROOT=$HOME/.dotnet -export EDITOR="hx" + +if which hx >/dev/null 2>&1; then + export EDITOR="hx" +fi + export PAGER="less" complete -C /usr/bin/terraform terraform # Created by `pipx` on 2022-11-14 15:41:06 -export PATH="$PATH:/home/ctome/.local/bin" +export PATH="$PATH":/home/ctome/.local/bin # >>> talisman >>> # Below environment variables should not be modified unless you know what you are doing export TALISMAN_HOME=/home/ctome/.talisman/bin -alias talisman=$TALISMAN_HOME/talisman_linux_amd64 +alias talisman="$TALISMAN_HOME"/talisman_linux_amd64 export TALISMAN_INTERACTIVE=true # <<< talisman <<< -. "$HOME/.cargo/env" +. "$HOME"/.cargo/env eval "$(mcfly init bash)" export MCFLY_LIGHT=FALSE export MCFLY_KEY_SCHEME=vim diff --git a/fedora/.bashrc.d/.bash_aliases b/fedora/.bashrc.d/.bash_aliases index 8e203be..16ea356 100644 --- a/fedora/.bashrc.d/.bash_aliases +++ b/fedora/.bashrc.d/.bash_aliases @@ -41,10 +41,10 @@ alias pullall='for i in */.git; do cd $(dirname $i); git pull -q; cd ..; done; e # git functions gitresettoremote() { - read -p "Enter branch name: " branchname + read -rp "Enter branch name: " branchname git fetch origin - git checkout $branchname - git reset --hard origin/$branchname + git checkout "$branchname" + git reset --hard origin/"$branchname" git clean -d --force } gitamendfiles() { @@ -53,21 +53,21 @@ gitamendfiles() { } gittimemachine() { git reflog - read -p "Enter index: " index + read -rp "Enter index: " index # you will see a list of every thing you've # done in git, across all branches! # each one has an index HEAD@{index} # find the one before you broke everything - git reset HEAD@{$index} + git reset HEAD@"$index" # magic time machine } gitcloneorg() { - read -p "Enter org name: " name - GHORG={$name}; curl "https://api.github.com/orgs/$GHORG/repos?per_page=1000" | grep -o 'git@[^"]*' | xargs -L1 git clone + read -rp "Enter org name: " name + GHORG="$name"; curl "https://api.github.com/orgs/$GHORG/repos?per_page=1000" | grep -o 'git@[^"]*' | xargs -L1 git clone } -function gi() { - curl -sL https://www.toptal.com/developers/gitignore/api/$@ ; +gi() { + curl -sL https://www.toptal.com/developers/gitignore/api/"$*" ; } # gh aliases @@ -154,7 +154,7 @@ up () { #goes up x directories # # usage: ex ex () { - if [ -f $1 ] ; then + if [ -f "$1" ] ; then case $1 in *.tar.bz2) tar xjf $1 ;; *.tar.gz) tar xzf $1 ;; @@ -186,7 +186,7 @@ alias eb='clear && exec bash' #reload bash and clear the terminal screen alias upstats='echo "Up since:" && uptime -s && uptime -p' #displays uptime stats alias reboot='sudo reboot' #https://github.com/gleitz/howdoi -alias h='function hdi(){ howdoi $* -c; }; hdi' +hdi(){ howdoi "$*" -c; } alias pyvenv='virtualenv env -p python3 && source env/bin/activate' # start a python virtual environment # top for containers @@ -200,6 +200,6 @@ ctop(){ listen-to-yt() { if [[ -z "$1" ]]; then echo "Enter a search string!"; - else mpv "$(youtube-dl --default-search 'ytsearch1:' \"$1\" --get-url | tail -1)"; + else mpv "$(youtube-dl --default-search "ytsearch1:" \""$1"\" --get-url | tail -1)"; fi }