You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/usr/bin/env bash
  2. ### BEG SCRIPT INFO
  3. #
  4. # Header:
  5. #
  6. # fname : "ana-init"
  7. # cdate : "24.05.2018"
  8. # author : "Michał Żurawski <trimstray@gmail.com>"
  9. # tab_size : "2"
  10. # soft_tabs : "yes"
  11. #
  12. # Description:
  13. #
  14. # See README.md file for more information.
  15. #
  16. # License:
  17. #
  18. # awesome-ninja-admins, Copyright (C) 2018 Michał Żurawski
  19. #
  20. # This program is free software: you can redistribute it and/or modify
  21. # it under the terms of the GNU General Public License as published by
  22. # the Free Software Foundation, either version 3 of the License, or
  23. # (at your option) any later version.
  24. #
  25. # This program is distributed in the hope that it will be useful,
  26. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  28. # GNU General Public License for more details.
  29. #
  30. # You should have received a copy of the GNU General Public License
  31. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  32. #
  33. ### END SCRIPT INFO
  34. # The array that store call parameters.
  35. # shellcheck disable=SC2034
  36. __init_params=()
  37. __script_params=("$@")
  38. # Store the name of the script and directory call.
  39. readonly _ana_dir="${HOME}/.awesome-ninja-admins"
  40. # Directory structure.
  41. # shellcheck disable=SC2154
  42. readonly _ana_src="${_ana_dir}/src"
  43. readonly _ana_lib="${_ana_dir}/lib"
  44. # shellcheck disable=SC1090,SC1091
  45. source "${_ana_src}/settings"
  46. # shellcheck disable=SC1090
  47. source "${_ana_src}/helpers"
  48. # Include main configuration file.
  49. # shellcheck disable=SC1090
  50. source "${_ana_dir}/ana.conf" || (printf "%s\\n" "file not found" ; exit)
  51. # shellcheck disable=SC2154
  52. for _i in "${_functions[@]}" ; do
  53. _fd="${_ana_lib}/functions/${_i}"
  54. if [[ ! -z "$_fd" ]] && [[ -e "$_fd" ]] ; then
  55. # If the file exists is loaded.
  56. # shellcheck disable=SC1090
  57. source "${_fd}"
  58. fi
  59. done
  60. # shellcheck disable=SC2154
  61. for _i in "${_aliases[@]}" ; do
  62. _fd="${_ana_lib}/aliases/${_i}"
  63. if [[ ! -z "$_fd" ]] && [[ -e "$_fd" ]] ; then
  64. # If the file exists is loaded.
  65. # shellcheck disable=SC1090
  66. source "${_fd}"
  67. fi
  68. done