mirror of
https://github.com/RyanGreenup/cadmus.git
synced 2025-08-17 19:36:23 +02:00
Created Template
This commit is contained in:
105
bin/NoteRecollSearch.sh
Executable file
105
bin/NoteRecollSearch.sh
Executable file
@@ -0,0 +1,105 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Author: Ryan Greenup <ryan.greenup@protonmail.com>
|
||||||
|
|
||||||
|
# * Shell Settings
|
||||||
|
set -o errexit # abort on nonzero exitstatus
|
||||||
|
set -o nounset # abort on unbound variable
|
||||||
|
set -o pipefail # don't hide errors within pipes
|
||||||
|
|
||||||
|
# * Main Function
|
||||||
|
main() {
|
||||||
|
|
||||||
|
check_for_dependencies
|
||||||
|
setVars
|
||||||
|
readFirstArgument "${@}"
|
||||||
|
NoteSearchRecoll "${@}"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# ** Helper Functions
|
||||||
|
# *** Check for Dependencies
|
||||||
|
check_for_dependencies () {
|
||||||
|
|
||||||
|
for i in ${DependArray[@]}; do
|
||||||
|
command -v "$i" >/dev/null 2>&1 || { echo >&2 "I require $i but it's not installed. Aborting."; exit 1; }
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# **** List of Dependencies
|
||||||
|
|
||||||
|
declare -a DependArray=(
|
||||||
|
"rg"
|
||||||
|
"sk"
|
||||||
|
"mdcat"
|
||||||
|
"xclip"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# *** Set variables below main
|
||||||
|
setVars () {
|
||||||
|
readonly script_name=$(basename "${0}")
|
||||||
|
readonly script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||||
|
IFS=$'\t\n' # Split on newlines and tabs (but not on spaces)
|
||||||
|
}
|
||||||
|
|
||||||
|
# **** Print Help
|
||||||
|
Help () {
|
||||||
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo -e " \e[3m\e[1mNoteFind.sh \e[0m; Helpful Shell Scripts for Markdown Notes"
|
||||||
|
echo -e " \e[1;31m--------------------------\e[0m "
|
||||||
|
echo
|
||||||
|
echo -e " \e[3m\e[1m• Usage \e[0m "
|
||||||
|
echo
|
||||||
|
echo -e " "${script_name}" [<path/to/notes>]"
|
||||||
|
echo -e " "${script_name}" [-h]"
|
||||||
|
echo -e " "${script_name}" [--help]"
|
||||||
|
echo
|
||||||
|
echo -e " \e[3m By Design: No Options; No other Arguments\e[0m"
|
||||||
|
echo
|
||||||
|
echo -e " \e[3m\e[1m• Key Bindings\e[0m "
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo -e " \e[1;91m \e[1m Binding \e[0m\e[0m \e[1;34m┊┊┊ \e[0m Description "
|
||||||
|
echo -e " ..............\e[1;34m┊┊┊\e[0m........................................... "
|
||||||
|
echo -e " \e[1;95m Ctrl - q \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Search \e[0m with \e[0m\e[3mripgrep\e[0m"
|
||||||
|
echo -e " \e[1;93m Ctrl - w \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Copy \e[0m the Full Path to the Clipboard"
|
||||||
|
echo -e " \e[1;93m Alt - w \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Copy \e[0m the Relative Path to the Clipboard"
|
||||||
|
echo -e " \e[1;94m Alt - e \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Open \e[0m in Emacs"
|
||||||
|
echo -e " \e[1;94m Alt - v \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Open \e[0m in VSCode"
|
||||||
|
echo -e " \e[1;94m Ctrl - o \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Open \e[0m in Default Program"
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo -e " \e[3m\e[1m• Compatability \e[0m "
|
||||||
|
echo
|
||||||
|
echo -e " Match highlighting occurs automatically if \e[1m\$SHELL\e[0m is \e[1m **/fish\e[0m"
|
||||||
|
echo -e " This uses \e[1mtmpfs\e[0m at \e[1m /dev/shm\e[0m, this should work on \e[3mArch\e[0m, \e[3mFedora\e[0m and \e[3mUbuntu\e[0m, I don't know about \e[3mMacOS\e[0m "
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# *** Read First Argument
|
||||||
|
readFirstArgument () {
|
||||||
|
|
||||||
|
if [[ "${1:-}" == "-h" ]] || [[ "${1:-}" == "--help" ]] || [[ "${1:-}" == "" ]]; then
|
||||||
|
Help && exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
# *** Note Recoll Search
|
||||||
|
NoteRecollSearch () {
|
||||||
|
|
||||||
|
## Change directory if One was specified, exit if no directory exists
|
||||||
|
cd "${1}"
|
||||||
|
|
||||||
|
echo "This is the function"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# * Call Main Function
|
||||||
|
main "${@}"
|
13
bin/cadmus
13
bin/cadmus
@@ -1,5 +1,5 @@
|
|||||||
#! /usr/bin/env bash
|
#! /usr/bin/env bash
|
||||||
NOTES_DIR="~/Notes/MD" ## TODO Global Variables are bad
|
NOTES_DIR="~/Notes/MD/notes" ## TODO Global Variables are bad
|
||||||
# Author: Ryan Greenup <ryan.greenup@protonmail.com>
|
# Author: Ryan Greenup <ryan.greenup@protonmail.com>
|
||||||
# abort on nonzero exitstatus
|
# abort on nonzero exitstatus
|
||||||
set -o errexit
|
set -o errexit
|
||||||
@@ -115,9 +115,16 @@ function NoteFind() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
main "${@}"
|
|
||||||
|
|
||||||
# *** All the Help
|
# *** All the Help
|
||||||
subHelp () {
|
subHelp () {
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo -e "\e[1;35m -------------------------\e[0m "
|
||||||
|
echo -e " \e[1;94m\e[3m\e[1m Cadmus Find \e[0m"
|
||||||
|
echo -e "\e[1;35m -------------------------\e[0m "
|
||||||
NoteFind.sh -h
|
NoteFind.sh -h
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# * Call the Main Function
|
||||||
|
main "${@}"
|
||||||
|
|
||||||
|
105
bin/template.sh
Executable file
105
bin/template.sh
Executable file
@@ -0,0 +1,105 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Author: Ryan Greenup <ryan.greenup@protonmail.com>
|
||||||
|
|
||||||
|
# * Shell Settings
|
||||||
|
set -o errexit # abort on nonzero exitstatus
|
||||||
|
set -o nounset # abort on unbound variable
|
||||||
|
set -o pipefail # don't hide errors within pipes
|
||||||
|
|
||||||
|
# * Main Function
|
||||||
|
main() {
|
||||||
|
|
||||||
|
check_for_dependencies
|
||||||
|
setVars
|
||||||
|
readFirstArgument "${@}"
|
||||||
|
NoteSearchRecoll "${@}"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# ** Helper Functions
|
||||||
|
# *** Check for Dependencies
|
||||||
|
check_for_dependencies () {
|
||||||
|
|
||||||
|
for i in ${DependArray[@]}; do
|
||||||
|
command -v "$i" >/dev/null 2>&1 || { echo >&2 "I require $i but it's not installed. Aborting."; exit 1; }
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# **** List of Dependencies
|
||||||
|
|
||||||
|
declare -a DependArray=(
|
||||||
|
"rg"
|
||||||
|
"sk"
|
||||||
|
"mdcat"
|
||||||
|
"xclip"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# *** Set variables below main
|
||||||
|
setVars () {
|
||||||
|
readonly script_name=$(basename "${0}")
|
||||||
|
readonly script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||||
|
IFS=$'\t\n' # Split on newlines and tabs (but not on spaces)
|
||||||
|
}
|
||||||
|
|
||||||
|
# **** Print Help
|
||||||
|
Help () {
|
||||||
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo -e " \e[3m\e[1mNoteFind.sh \e[0m; Helpful Shell Scripts for Markdown Notes"
|
||||||
|
echo -e " \e[1;31m--------------------------\e[0m "
|
||||||
|
echo
|
||||||
|
echo -e " \e[3m\e[1m• Usage \e[0m "
|
||||||
|
echo
|
||||||
|
echo -e " "${script_name}" [<path/to/notes>]"
|
||||||
|
echo -e " "${script_name}" [-h]"
|
||||||
|
echo -e " "${script_name}" [--help]"
|
||||||
|
echo
|
||||||
|
echo -e " \e[3m By Design: No Options; No other Arguments\e[0m"
|
||||||
|
echo
|
||||||
|
echo -e " \e[3m\e[1m• Key Bindings\e[0m "
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo -e " \e[1;91m \e[1m Binding \e[0m\e[0m \e[1;34m┊┊┊ \e[0m Description "
|
||||||
|
echo -e " ..............\e[1;34m┊┊┊\e[0m........................................... "
|
||||||
|
echo -e " \e[1;95m Ctrl - q \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Search \e[0m with \e[0m\e[3mripgrep\e[0m"
|
||||||
|
echo -e " \e[1;93m Ctrl - w \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Copy \e[0m the Full Path to the Clipboard"
|
||||||
|
echo -e " \e[1;93m Alt - w \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Copy \e[0m the Relative Path to the Clipboard"
|
||||||
|
echo -e " \e[1;94m Alt - e \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Open \e[0m in Emacs"
|
||||||
|
echo -e " \e[1;94m Alt - v \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Open \e[0m in VSCode"
|
||||||
|
echo -e " \e[1;94m Ctrl - o \e[0m \e[1;34m ┊┊┊ \e[0m \e[1m Open \e[0m in Default Program"
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo -e " \e[3m\e[1m• Compatability \e[0m "
|
||||||
|
echo
|
||||||
|
echo -e " Match highlighting occurs automatically if \e[1m\$SHELL\e[0m is \e[1m **/fish\e[0m"
|
||||||
|
echo -e " This uses \e[1mtmpfs\e[0m at \e[1m /dev/shm\e[0m, this should work on \e[3mArch\e[0m, \e[3mFedora\e[0m and \e[3mUbuntu\e[0m, I don't know about \e[3mMacOS\e[0m "
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# *** Read First Argument
|
||||||
|
readFirstArgument () {
|
||||||
|
|
||||||
|
if [[ "${1:-}" == "-h" ]] || [[ "${1:-}" == "--help" ]] || [[ "${1:-}" == "" ]]; then
|
||||||
|
Help && exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
# *** Note Recoll Search
|
||||||
|
NoteRecollSearch () {
|
||||||
|
|
||||||
|
## Change directory if One was specified, exit if no directory exists
|
||||||
|
cd "${1}"
|
||||||
|
|
||||||
|
echo "This is the function"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# * Call Main Function
|
||||||
|
main "${@}"
|
Reference in New Issue
Block a user