diff options
author | cos <cos> | 2021-12-02 10:35:51 +0100 |
---|---|---|
committer | cos <cos> | 2021-12-02 10:35:51 +0100 |
commit | f4400c6410f4b932eb738760996e0dcc271157f1 (patch) | |
tree | 1d65def35b71b527a745eab9df1546683b05ee59 | |
parent | c8f898354dcfc52d31fa8830bc1c7a931697c7e0 (diff) | |
download | adventofcode-f4400c6410f4b932eb738760996e0dcc271157f1.zip |
Verify dependencies for fetch_input are available
-rwxr-xr-x | bin/fetch_input.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/fetch_input.sh b/bin/fetch_input.sh index 6b27931..d3a96ec 100755 --- a/bin/fetch_input.sh +++ b/bin/fetch_input.sh @@ -1,4 +1,5 @@ #!/bin/sh -eu +# vim: sw=2 et COOKIES="${HOME}/.adventofcode.json" @@ -11,6 +12,20 @@ MODE="wget" # https://stackoverflow.com/q/21919156/how-do-i-copy-cookies-from-chrome SESSION=$(jq < "${COOKIES}" '."session-cookie"') +check_dependency_availability() { + local bin + + for bin in 'elinks' \ + 'jq' \ + 'wget' + do + if ! which "${bin}" >/dev/null; then + echo "Missing dependency: ${bin}" >&2 + exit 1 + fi + done +} + concat() { local part @@ -26,6 +41,8 @@ authenticated_wget() { "${@}" } +check_dependency_availability + if [ "${MODE}" = 'wget' ]; then cd "${YEAR}" cd 'rust' |