chore: add src

This commit is contained in:
Jesús Pérez Lorenzo 2021-09-01 20:20:15 +01:00
parent c3e9b36430
commit 44abbb1012
3 changed files with 36 additions and 0 deletions

18
Cargo.toml Normal file
View File

@ -0,0 +1,18 @@
[package]
name = "lib_tests"
version = "0.1.0"
authors = ["JesusPerez <jpl@jesusperez.pro>"]
edition = "2018"
[dependencies]
anyhow = "1.0.40"
envmnt = "0.9.0"
serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0.125"
serde_json = "1.0.64"
serde_yaml = "0.8.17"
toml = "0.5.8"
[dev-dependencies]
#pretty_assertions = "0.6.1"
# test-case = "1.1.0"

5
TODO.md Normal file
View File

@ -0,0 +1,5 @@
### Test library
- [ ] Implement more tests
- [ ] Use [Test Case](https://github.com/frondeus/test-case)

13
src/lib.rs Normal file
View File

@ -0,0 +1,13 @@
use dsc::{
utils::load_fs_content,
};
use anyhow::{Result};
pub fn load_fs_data_content() -> Result<String> {
let data_path = &envmnt::get_or("DATA_PATH", ".");
let data_target = &envmnt::get_or("DATA_TARGET", "data");
let data_frmt = &envmnt::get_or("DATA_FORMAT", "yaml");
println!("Data path: {} in {} format.", &data_path, &data_frmt);
Ok(load_fs_content(&data_path, &data_target, &data_frmt))
}