Skip to content

Commit

Permalink
Create base files and directories
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandoaleman committed Oct 13, 2023
1 parent a009cbd commit 71946b3
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
disable=SC2016,SC2059,SC2154
disable=SC3043
39 changes: 39 additions & 0 deletions mac
Original file line number Diff line number Diff line change
@@ -1,2 +1,41 @@
#!/bin/sh

fancy_echo() {
local fmt="$1"; shift
printf "\\n$fmt\\n" "$@"
}

append_to_zshrc() {
local text="$1" zshrc
local skip_new_line="${2:-0}"

if [ -w "$HOME/.zshrc.local" ]; then
zshrc="$HOME/.zshrc.local"
else
zshrc="$HOME/.zshrc"
fi

if ! grep -Fqs "$text" "$zshrc"; then
if [ "$skip_new_line" -eq 1 ]; then
printf "%s\\n" "$text" >> "$zshrc"
else
printf "\\n%s\\n" "$text" >> "$zshrc"
fi
fi
}

trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT

set -e

if [ ! -f "$HOME/.zshrc" ]; then
touch "$HOME/.zshrc"
fi

if [ ! -d "$HOME/.bin/" ]; then
mkdir "$HOME/.bin"
fi

append_to_zshrc 'export PATH="$HOME/.bin:$PATH"'

# ft=shell

0 comments on commit 71946b3

Please sign in to comment.