| Crates.io | cco |
| lib.rs | cco |
| version | 0.2.0 |
| created_at | 2024-01-05 22:55:19.63771+00 |
| updated_at | 2025-08-18 13:28:54.738061+00 |
| description | cascading configuration |
| homepage | https://github.com/denfren/cco |
| repository | https://github.com/denfren/cco |
| max_upload_size | |
| id | 1090563 |
| size | 185,519 |
TL;DR: Transforms HCL to json or yaml.
cco e[valuate] <file...> to evaluate HCL filescco import <file> to convert a json or yaml file to HCLcco evaluate [[<identifier>=]<file>...] loads each file into a global context. If an identifier is provided, the file
is loaded into a variable under that name instead. cco resolves all expressions and prints the global context as json
or yaml to stdout.
Alternatively, cco evaluate [-e/--expression <hcl-expression>] [<files...>] can be used to evaluate a single hcl
expression.
Output
stdout: hcl/yaml/json outputstderr: log messagesExit Codes
== 0: success!= 0: failure
1: general error2: invalid invocation / help displayed>=3: reserved/unusedEnvironment Variables
CCO_LOG: configure logging. see
tracing_subscriber's env_filter directive
for value format.The following functions are available for use in HCL expressions. The subject is always the first argument. If the
argument is denoted as ..., then multiple individual arguments or a single list are accepted.
Currently, functions are namespaced by type. Maybe this is not a good idea but it keeps the unnamespaced functions open for future use. Subject to change...
str)str::empty(string) → bool: Returns true if string is emptystr::len(string) → number: Returns the length of the stringstr::trim(string) → string: Removes whitespace from both endsstr::trim_start(string) → string: Removes whitespace from the startstr::trim_end(string) → string: Removes whitespace from the endstr::contains(subject, search) → bool: Returns true if subject contains searchstr::starts_with(subject, prefix) → bool: Returns true if subject starts with prefixstr::ends_with(subject, suffix) → bool: Returns true if subject ends with suffixstr::to_upper(string) → string: Converts string to uppercasestr::to_lower(string) → string: Converts string to lowercasestr::split(string, delimiter) → list: Splits string by delimiter into a liststr::join(..., separator) → string: Joins strings with separator (accepts list or multiple arguments)str::concat(...) → string: Concatenates strings (accepts list or multiple arguments)str::replace(string, old, new) → string: Replaces all occurrences of old with newstr::reverse(string) → string: Reverses the stringpath)path::basename(path) or path::file_name(path) → string: Returns the file namepath::file_stem(path) → string: Returns the file name without extensionpath::file_ext(path) → string: Returns the file extensionpath::dirname(path) → string: Returns the parent directorypath::join(...) → string: Joins path segments (accepts list or multiple arguments)list)list::empty(list) → bool: Returns true if list is emptylist::len(list) → number: Returns the length of the listlist::all(...) → bool: Returns true if all booleans are true (accepts list or multiple arguments)list::any(...) → bool: Returns true if any boolean is true (accepts list or multiple arguments)list::first(list) → any: Returns the first elementlist::last(list) → any: Returns the last elementlist::reverse(list) → list: Returns a reversed copy of the listlist::contains(list, value) → bool: Returns true if list contains valuemap)map::empty(map) → bool: Returns true if map is emptymap::len(map) → number: Returns the number of keys in the mapmap::keys(map) → list: Returns a list of all keysmap::values(map) → list: Returns a list of all valuesmap::has_key(map, key) → bool: Returns true if map contains keymap::merge(...) → map: Merges maps (accepts list or multiple arguments)math)int::abs(number) → int: Returns the absolute valueint::sum(...) → int: Returns the sum of all valuesint::min(...) → int: Returns the smallest numberint::max(...) → int: Returns the largest numberint::clamp(number, min, max) → int: Returns a value between min and max, or min/max when the value is outside of
the rangetime)time::minutes(number) → int: Returns the number of seconds in number of hours (60 seconds)time::hours(number) → int: Returns the number of seconds in number of hours (60 minutes)time::days(number) → int: Returns the number of seconds in number of days (24 hours)time::weeks(number) → int: Returns the number of seconds in number of weeks (7 days)