Skip to content

map Functions

🛠️ Tools · ⬅ Home


Mapping in this context refers to replacing tokens in a file from one value to another; useful for simple templates and configuration customizations.

Arguments

  • environmentVariableName - String. Optional. Map this value only. If not specified, all environment variables are mapped.
  • --prefix - String. Optional. Prefix character for tokens, defaults to {.
  • --suffix - String. Optional. Suffix character for tokens, defaults to }.
  • --search-filter - Zero or more. Callable. Filter for search tokens. (e.g. lowercase)
  • --replace-filter - Zero or more. Callable. Filter for replacement strings. (e.g. trimSpace)
  • --help - Flag. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Requires

environmentVariables cat throwEnvironment catchEnvironment throwArgument decorate validate

Usage

mapValue [ --help ] [ --handler handler ] mapFile [ value ] [ --prefix ] [ --suffix ] [ --search-filter ] [ --replace-filter ]

Maps a string using an environment file

Arguments

  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • mapFile - File. Required. a file containing bash environment definitions
  • value - String. Optional. One or more values to map using said environment file
  • --prefix - String. Optional. Token prefix defaults to {.
  • --suffix - String. Optional. Token suffix defaults to }.
  • --search-filter - Zero or more. Callable. Filter for search tokens. (e.g. lowercase)
  • --replace-filter - Zero or more. Callable. Filter for replacement strings. (e.g. trimSpace)

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Usage

mapValueTrim mapFile [ value ]

Maps a string using an environment file

Arguments

  • mapFile - File. Required. a file containing bash environment definitions
  • value - String. Optional. One or more values to map using said environment file.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Usage

isMappable [ --help ] [ --prefix ] [ --suffix ] [ --token ] [ text ]

Check if text contains mappable tokens If any text passed contains a token which can be mapped, succeed.

Arguments

  • --help - Flag. Optional. Display this help.
  • --prefix - String. Optional. Token prefix defaults to {.
  • --suffix - String. Optional. Token suffix defaults to }.
  • --token - String. Optional. Classes permitted in a token
  • text - String. Optional. Text to search for mapping tokens.

Return codes

  • 0 - Text contains mapping tokens
  • 1 - Text does not contain mapping tokens

Usage

mapTokens [ `prefix` ] [ `suffix` ]

No documentation for mapTokens.

Arguments

  • prefix - Optional prefix for token search, defaults to { (same as map.sh)
  • suffix - Optional suffix for token search, defaults to } (same as map.sh)

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

  • None.