Namespace src/Conf

src/Conf

Overview

Directory src/Conf

file source src/Conf/getAbsoluteFile.sh

Conf::getAbsoluteFile

get absolute conf file from specified conf folder deduced using these rules

  • from absolute file (ignores and )
  • relative to where script is executed (ignores and )
  • from home/.bash-tools/
  • from framework conf/
Arguments
  • $1 (confFolder:String): the directory name (not the path) to list
  • $2 (conf:String): file to use without extension
  • $3 (extension:String): the extension (.sh by default)
Exit codes
  • 1: if file is not found in any location
Output on stdout
  • absolute conf filename

src/Conf/getMergedList.sh

file source src/Conf/getMergedList.sh

Conf::getMergedList

list the conf files list available in bash-tools/conf/ folder and those overridden in ${HOME}/.bash-tools/ folder

Example
- default.local
- default.remote
- localhost-root
Arguments
  • $1 (confFolder:String): the directory name (not the path) to list
  • $2 (extension:String): the extension (.sh by default)
  • $3 (indentStr:String): the indentation (’ - ’ by default) can be any string compatible with sed not containing any /
Output on stdout
  • list of files without extension/directory

src/Conf/list.sh

file source src/Conf/list.sh

Conf::list

list files of dir with given extension and display it as a list one by line

Example
      - default.local
      - default.remote
      - localhost-root
@exitcode 1 if directory does not exists
Arguments
  • $1 (dir:String): the directory to list
  • $2 (prefix:String): the profile file prefix (default: “”)
  • $3 (ext:String): the extension
  • $4 (findOptions:String): find options, eg: -type d (Default value: ‘-type f’)
  • $5 (indentStr:String): the indentation can be any string compatible with sed not containing any / (Default value: ’ - ‘)
Output on stdout
  • list of files without extension/directory

src/Conf/load.sh

file source src/Conf/load.sh

Conf::load

get absolute file from name deduced using these rules

  • using absolute/relative file (ignores and
  • from home/.bash-tools// file
  • from framework conf/ file
Arguments
  • $1 (confFolder:String): directory to use (traditionally below bash-tools conf folder)
  • $2 (conf:String): file to use without extension
  • $3 (extension:String): file extension to use (default: .sh)
Exit codes
  • 1: if file not found or error during file loading

src/Conf/loadNearestFile.sh

file source src/Conf/loadNearestFile.sh

Conf::loadNearestFile

Load the nearest config file in next example will search first .framework-config file in “srcDir1” then if not found will go in up directories until / then will search in “srcDir2” then if not found will go in up directories until / source the file if found

Example
Conf::loadNearestFile ".framework-config" "srcDir1" "srcDir2"
Arguments
  • $1 (configFileName:String): config file name to search
  • $2 (loadedFile:String): (passed by reference) will return the loaded config file name
  • (srcDirs:String[]): source directories in which the config file will be searched
Exit codes
  • 0: if file found
  • 1: if file not found
Or, if you want, you can alternatively use the GitHub discussion Q&A for feedback and questions.