Loading lcov.info +27 −27 Original line number Diff line number Diff line Loading @@ -673,7 +673,7 @@ FNDA:1,Script::expand_arguments_from FNDA:0,Script::from_module FNDA:1,Script::from_path FNDA:1,Script::from_template FNDA:1,Script::get_command FNDA:2,Script::get_command FNDA:1,Script::get_arguments FNDA:0,Script::maybe_create_virtual_environment FNDA:1,Script::maybe_git_clone Loading @@ -688,7 +688,7 @@ FNDA:0,ScriptTemplate::resolve_python_virtual_environment FNDA:1,StringTemplate::new FNDA:1,StringTemplate::expand FNDA:1,StringTemplate::get_variable FNDA:1,StringTemplate::is_handlebars FNDA:2,StringTemplate::is_handlebars FNDA:1,StringTemplate::remove_spaces FNDA:1,get_conda_environment_list DA:300,1 Loading Loading @@ -851,15 +851,15 @@ DA:644,1 DA:645,1 DA:646,1 DA:648,1 DA:650,1 DA:651,1 DA:650,2 DA:651,2 DA:652,1 DA:653,1 DA:655,1 DA:653,2 DA:655,2 DA:656,2 DA:657,1 DA:657,2 DA:660,1 DA:661,1 DA:661,2 DA:662,1 DA:663,1 DA:664,1 Loading @@ -869,7 +869,7 @@ DA:668,0 DA:669,0 DA:672,2 DA:673,1 DA:675,1 DA:675,2 DA:677,1 DA:678,1 DA:679,1 Loading Loading @@ -921,21 +921,21 @@ DA:762,1 DA:763,1 DA:764,1 DA:765,2 DA:766,2 DA:766,3 DA:767,2 DA:768,1 DA:769,9 DA:769,14 DA:770,2 DA:771,2 DA:772,2 DA:773,1 DA:774,1 DA:779,2 DA:780,2 DA:772,1 DA:773,2 DA:774,2 DA:779,3 DA:780,1 DA:782,0 DA:783,0 DA:786,2 DA:787,2 DA:786,1 DA:787,1 DA:788,2 DA:789,2 DA:792,2 Loading Loading @@ -996,9 +996,9 @@ DA:920,0 DA:921,0 DA:922,0 DA:932,1 DA:934,1 DA:934,2 DA:941,1 DA:942,5 DA:942,4 DA:943,3 DA:948,1 DA:949,2 Loading @@ -1006,17 +1006,17 @@ DA:950,3 DA:951,1 DA:952,2 DA:954,0 DA:978,1 DA:979,2 DA:980,2 DA:981,1 DA:978,2 DA:979,4 DA:980,3 DA:981,2 DA:982,0 DA:984,0 DA:1013,1 DA:1014,2 DA:1015,1 DA:1015,2 DA:1016,0 DA:1018,3 DA:1018,6 DA:1019,1 DA:1023,1 DA:1024,1 Loading Loading @@ -1102,7 +1102,7 @@ DA:54,1 DA:55,1 DA:57,1 DA:58,1 DA:59,1 DA:59,2 DA:61,0 DA:62,0 DA:63,0 Loading xylem-lib/src/config.rs +2 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ use tracing::{debug, error, info, warn}; use uriparse::Scheme; use crate::script::*; use crate::util::{self, download_binary, get_children, get_extension, make_executable, path_to_string, read_file, snake_case, Label}; use crate::util::{self, download_binary, extension, get_children, make_executable, path_to_string, read_file, snake_case, Label}; enum Extension { Json, Loading Loading @@ -402,7 +402,7 @@ impl Config { self } pub fn read(path: PathBuf) -> Option<Config> { let content = match Extension::from_string(get_extension(&path)) { let content = match Extension::from_string(extension(&path)) { | Extension::Json => match Config::read_json(path.clone()) { | Ok(value) => Some(value), | Err(_) => None, Loading xylem-lib/src/util.rs +6 −6 Original line number Diff line number Diff line Loading @@ -192,14 +192,14 @@ pub fn get_children(path: String) -> Vec<String> { /// # Examples /// ``` /// use std::path::Path; /// use xylem_lib::util::get_extension; /// use xylem_lib::util::extension; /// /// assert_eq!("txt", get_extension(Path::new("hello.txt"))); /// assert_eq!("md", get_extension(Path::new("README.md"))); /// assert_eq!("", get_extension(Path::new(".dotfile"))); /// assert_eq!("", get_extension(Path::new("/path/to/folder"))); /// assert_eq!("txt", extension(Path::new("hello.txt"))); /// assert_eq!("md", extension(Path::new("README.md"))); /// assert_eq!("", extension(Path::new(".dotfile"))); /// assert_eq!("", extension(Path::new("/path/to/folder"))); /// ``` pub fn get_extension(path: &Path) -> String { pub fn extension(path: &Path) -> String { path.extension().unwrap_or_default().to_str().unwrap_or_default().to_string() } /// Check if stdin is piped (e.g., `echo "hello world" | xylem`) Loading Loading
lcov.info +27 −27 Original line number Diff line number Diff line Loading @@ -673,7 +673,7 @@ FNDA:1,Script::expand_arguments_from FNDA:0,Script::from_module FNDA:1,Script::from_path FNDA:1,Script::from_template FNDA:1,Script::get_command FNDA:2,Script::get_command FNDA:1,Script::get_arguments FNDA:0,Script::maybe_create_virtual_environment FNDA:1,Script::maybe_git_clone Loading @@ -688,7 +688,7 @@ FNDA:0,ScriptTemplate::resolve_python_virtual_environment FNDA:1,StringTemplate::new FNDA:1,StringTemplate::expand FNDA:1,StringTemplate::get_variable FNDA:1,StringTemplate::is_handlebars FNDA:2,StringTemplate::is_handlebars FNDA:1,StringTemplate::remove_spaces FNDA:1,get_conda_environment_list DA:300,1 Loading Loading @@ -851,15 +851,15 @@ DA:644,1 DA:645,1 DA:646,1 DA:648,1 DA:650,1 DA:651,1 DA:650,2 DA:651,2 DA:652,1 DA:653,1 DA:655,1 DA:653,2 DA:655,2 DA:656,2 DA:657,1 DA:657,2 DA:660,1 DA:661,1 DA:661,2 DA:662,1 DA:663,1 DA:664,1 Loading @@ -869,7 +869,7 @@ DA:668,0 DA:669,0 DA:672,2 DA:673,1 DA:675,1 DA:675,2 DA:677,1 DA:678,1 DA:679,1 Loading Loading @@ -921,21 +921,21 @@ DA:762,1 DA:763,1 DA:764,1 DA:765,2 DA:766,2 DA:766,3 DA:767,2 DA:768,1 DA:769,9 DA:769,14 DA:770,2 DA:771,2 DA:772,2 DA:773,1 DA:774,1 DA:779,2 DA:780,2 DA:772,1 DA:773,2 DA:774,2 DA:779,3 DA:780,1 DA:782,0 DA:783,0 DA:786,2 DA:787,2 DA:786,1 DA:787,1 DA:788,2 DA:789,2 DA:792,2 Loading Loading @@ -996,9 +996,9 @@ DA:920,0 DA:921,0 DA:922,0 DA:932,1 DA:934,1 DA:934,2 DA:941,1 DA:942,5 DA:942,4 DA:943,3 DA:948,1 DA:949,2 Loading @@ -1006,17 +1006,17 @@ DA:950,3 DA:951,1 DA:952,2 DA:954,0 DA:978,1 DA:979,2 DA:980,2 DA:981,1 DA:978,2 DA:979,4 DA:980,3 DA:981,2 DA:982,0 DA:984,0 DA:1013,1 DA:1014,2 DA:1015,1 DA:1015,2 DA:1016,0 DA:1018,3 DA:1018,6 DA:1019,1 DA:1023,1 DA:1024,1 Loading Loading @@ -1102,7 +1102,7 @@ DA:54,1 DA:55,1 DA:57,1 DA:58,1 DA:59,1 DA:59,2 DA:61,0 DA:62,0 DA:63,0 Loading
xylem-lib/src/config.rs +2 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ use tracing::{debug, error, info, warn}; use uriparse::Scheme; use crate::script::*; use crate::util::{self, download_binary, get_children, get_extension, make_executable, path_to_string, read_file, snake_case, Label}; use crate::util::{self, download_binary, extension, get_children, make_executable, path_to_string, read_file, snake_case, Label}; enum Extension { Json, Loading Loading @@ -402,7 +402,7 @@ impl Config { self } pub fn read(path: PathBuf) -> Option<Config> { let content = match Extension::from_string(get_extension(&path)) { let content = match Extension::from_string(extension(&path)) { | Extension::Json => match Config::read_json(path.clone()) { | Ok(value) => Some(value), | Err(_) => None, Loading
xylem-lib/src/util.rs +6 −6 Original line number Diff line number Diff line Loading @@ -192,14 +192,14 @@ pub fn get_children(path: String) -> Vec<String> { /// # Examples /// ``` /// use std::path::Path; /// use xylem_lib::util::get_extension; /// use xylem_lib::util::extension; /// /// assert_eq!("txt", get_extension(Path::new("hello.txt"))); /// assert_eq!("md", get_extension(Path::new("README.md"))); /// assert_eq!("", get_extension(Path::new(".dotfile"))); /// assert_eq!("", get_extension(Path::new("/path/to/folder"))); /// assert_eq!("txt", extension(Path::new("hello.txt"))); /// assert_eq!("md", extension(Path::new("README.md"))); /// assert_eq!("", extension(Path::new(".dotfile"))); /// assert_eq!("", extension(Path::new("/path/to/folder"))); /// ``` pub fn get_extension(path: &Path) -> String { pub fn extension(path: &Path) -> String { path.extension().unwrap_or_default().to_str().unwrap_or_default().to_string() } /// Check if stdin is piped (e.g., `echo "hello world" | xylem`) Loading