Cleaning up some scripts and moving to autoload functions

This commit is contained in:
2023-10-08 10:26:30 -04:00
parent 05b36efeea
commit 0f58b00f97
26 changed files with 123 additions and 102 deletions

View File

@@ -1,7 +0,0 @@
#!/bin/sh
session="dots"
tmux switch-client -t "$session" || \
tmux attach -t "$session" || \
tmux new-session -c "$DOTFILES" -s "$session"

View File

@@ -1,4 +0,0 @@
#!/bin/sh
# makes files executable
test -f "$1" && chmod +x "$1"

View File

@@ -1,5 +0,0 @@
#!/bin/sh
for file in "$SCREENSHOTS"/*; do
rm "$file"
done

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/zsh
# adapted from...
# https://github.com/rwxrob/dot/blob/main/scripts/cmt

View File

@@ -1,21 +0,0 @@
#!/bin/zsh
declare hide
declare show
zparseopts -D -E -K -- \
{h,-hide}=hide \
{s,-show}=show
if [ -n "$hide" ]; then
defaults write com.apple.finder CreateDesktop false && killall Finder
exit 0
fi
if [ -n "$show" ]; then
defaults write com.apple.finder CreateDesktop true && killall Finder
exit 0
fi
echo "Please pass in --hide | --show"
exit 1

View File

@@ -1,17 +0,0 @@
#!/bin/sh
# Creates an encrypted disk image from a folder
set -e
from="$1"
to="$2"
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: dmg <fromdir> <todir>"
echo ""
exit 1
fi
name="$(isosec).dmg"
hdiutil create -encryption AES-256 -srcfolder "$from" "$to/$name"

View File

@@ -1,9 +1,4 @@
#!/bin/sh
set -e
date -u '+%Y%m%d%H%M%S'
isosec() {
echo "$(date -u '+%Y%m%d%H%M%S')"
}
isosec

View File

@@ -1,5 +0,0 @@
#!/bin/bash
# Lists files and directories, including hidden files.
ls -lah --color "$@"

View File

@@ -1,12 +0,0 @@
#!/bin/sh
# Creates a directory then `cd`'s into the directory
set -e
dir="$1"
test -n "${dir}" || echo "usage: mkcd <dir>" && exit 1
mkdir "${dir}"
cd "${dir}"

View File

@@ -2,10 +2,10 @@
set -e
# Creates a new `zet` inside the House Call Pro `Zettlekasten`
# Creates a new `zet` inside the NCI Summit `Zettlekasten`
_main() {
(ZETDIR="$HOME/Documents/NCISummit" eval zet "$@")
ZETDIR="$HOME/Documents/NCISummit" eval zet "$@"
}
_main "$@"

View File

@@ -16,7 +16,7 @@ shell="${2:-sh}"
if [ -e "${path}" ]; then
echo "Already exists try:"
echo "vi ${path}"
echo "$EDITOR $path"
exit 1
fi

View File

@@ -1,13 +1,19 @@
#!/bin/sh
#!/bin/zsh
# Change / select an nvim configuration.
#
# The configuration's need to be in the ~/.config folder
# to work properly.
#
main() {
items=("default" "m-housh" "kickstart" "lazy")
config=$(printf "%s\n" "${items[@]}" | fzf --prompt=" Neovim Config ➣ " --height=50% --layout=reverse --border --exit-0)
if [[ -z $config ]]; then
config=$(printf "%s\n" "${items[@]}" \
| fzf --prompt=" Neovim Config ➣ " --height=50% --layout=reverse --border --exit-0
)
if [ -z "$config" ]; then
echo "Nothing selected"
return 0
elif [[ $config == "default" ]]; then
elif [ $config == "default" ]; then
config=""
fi
unset VIMINIT && unset MYVIMRC && export NVIM_APPNAME=$config && nvim $@

View File

@@ -1,4 +0,0 @@
#!/bin/zsh
# Move into the proposals directory
cd "$HOME/Library/Mobile Documents/com~apple~CloudDocs/Work/Proposals"

View File

@@ -2,7 +2,7 @@
set -e
# Creates a new `zet` inside the House Call Pro `Zettlekasten`
# Creates a new `zet` inside the private `Zettlekasten`
_main() {
(ZETDIR="$GHREPOS/private-zets" eval zet "$@")

View File

@@ -1,5 +0,0 @@
#!/bin/sh
# opens a shell command in $EDITOR
cmd="$(command -v $1)"
test -n "$cmd" && "$EDITOR" "$cmd"