diff --git a/cheats b/cheats new file mode 100755 index 0000000..f3e7aa8 --- /dev/null +++ b/cheats @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euo pipefail + +export DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" + +source "${DIR}/src/arg.sh" +source "${DIR}/src/cheat.sh" +source "${DIR}/src/docs.sh" +source "${DIR}/src/misc.sh" +source "${DIR}/src/selection.sh" +source "${DIR}/src/str.sh" +source "${DIR}/src/ui.sh" + +source "${DIR}/src/main.sh" + +##? Command cheatsheet tool +##? +##? Usage: +##? cheats [options] +##? +##? Options: +##? --print Prevent script execution [default: false] +##? --no-interpolation Prevent argument interpolation [default: false] +##? -c --cheat-folder Folder with cheatsheets + +docs::eval "$@" + +main "$@" diff --git a/src/cheat.sh b/src/cheat.sh index 2683cc2..85b6d36 100755 --- a/src/cheat.sh +++ b/src/cheat.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash cheat::find() { - find "${cheat_folder:-"${DIR}/../sheets"}" -iname '*.cheat' + find "${cheat_folder:-"${DIR}/sheets"}" -iname '*.cheat' } cheat::read_many() { diff --git a/src/cheats b/src/main.sh old mode 100755 new mode 100644 similarity index 58% rename from src/cheats rename to src/main.sh index 8b47b5a..4a2b1f6 --- a/src/cheats +++ b/src/main.sh @@ -1,28 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -export DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" - -source "${DIR}/arg.sh" -source "${DIR}/cheat.sh" -source "${DIR}/docs.sh" -source "${DIR}/misc.sh" -source "${DIR}/selection.sh" -source "${DIR}/str.sh" -source "${DIR}/ui.sh" - -##? Command cheatsheet tool -##? -##? Usage: -##? cheats [options] -##? -##? Options: -##? --print Prevent script execution [default: false] -##? --no-interpolation Prevent argument interpolation [default: false] -##? -c --cheat-folder Folder with cheatsheets - -docs::eval "$@" - main() { local readonly cheats="$(cheat::find)" local readonly selection="$(ui::select "$cheats")" @@ -57,5 +35,3 @@ main() { eval "$cmd" fi } - -main "$@" \ No newline at end of file