Move script

This commit is contained in:
Denis Isidoro 2019-09-20 10:59:53 -03:00
parent 588be03ae8
commit 4c9f8ba2ff
3 changed files with 29 additions and 25 deletions

28
cheats Executable file
View file

@ -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 <cheat-folder> Folder with cheatsheets
docs::eval "$@"
main "$@"

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cheat::find() { cheat::find() {
find "${cheat_folder:-"${DIR}/../sheets"}" -iname '*.cheat' find "${cheat_folder:-"${DIR}/sheets"}" -iname '*.cheat'
} }
cheat::read_many() { cheat::read_many() {

24
src/cheats → src/main.sh Executable file → Normal file
View file

@ -1,28 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail 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 <cheat-folder> Folder with cheatsheets
docs::eval "$@"
main() { main() {
local readonly cheats="$(cheat::find)" local readonly cheats="$(cheat::find)"
local readonly selection="$(ui::select "$cheats")" local readonly selection="$(ui::select "$cheats")"
@ -57,5 +35,3 @@ main() {
eval "$cmd" eval "$cmd"
fi fi
} }
main "$@"