lib_utils/app_tools
2021-09-01 20:12:27 +01:00
..
src chore: add app_tools 2021-09-01 20:12:27 +01:00
.gitignore chore: add app_tools 2021-09-01 20:12:27 +01:00
Cargo.toml chore: add app_tools 2021-09-01 20:12:27 +01:00
README.md chore: add app_tools 2021-09-01 20:12:27 +01:00
TODO.md chore: add app_tools 2021-09-01 20:12:27 +01:00

App Tools Utils library

Several functions to help in applications

Utility functions for variety of tasks

fn run_command(cmd: &str, arg1: &str, arg2: &str) -> anyhow::Result<()> 
fn from_base64(source: &str) -> String 

FromStr for RGB

Trim newline this function is critical for base64 content as usually adds a newline at the end, causing decode not work properly with code. trim_newline should be called to clean content before to be decoded.

fn trim_newline(s: &mut String) 
fn hash_from_data(path: &str, ctx: &mut tera::Context, data_hash: &mut HashMap<String, String>, load_extend: bool) -> anyhow::Result<()>

get_json_val is a simple match Option to remove quotes in json values and returned as a String

get_json_val(json_value: &serde_json::Value, dflt_val: String) -> String

get_toml_val is a simple match Option to remove quotes in json values and returned as a String

get_toml_val(toml_value: &toml::Value, dflt_val: String) -> String 

get_toml_val is a simple match Option to remove quotes in json values and returned as a String

get_yaml_val(yaml_value: &serde_yaml::Value, dflt_val: String) -> String 

Read a file_name from a path (root / file_name) ( "" file_name_full_path ) format of reading can be matched with file_type

read_path_file(path: &str, file_name: &str, file_type: &str) -> anyhow::Result<String>