diff --git a/src/cli.rs b/src/cli.rs index 53cd35afb..506b4d1c0 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,5 +1,5 @@ -use crate::info::info_field::InfoType; use crate::info::langs::language::{Language, LanguageType}; +use crate::info::utils::info_field::InfoType; use crate::ui::printer::SerializationFormat; use anyhow::Result; use clap::builder::PossibleValuesParser; diff --git a/src/info/repo/author.rs b/src/info/author.rs similarity index 98% rename from src/info/repo/author.rs rename to src/info/author.rs index eceb903dd..2611123ca 100644 --- a/src/info/repo/author.rs +++ b/src/info/author.rs @@ -2,8 +2,8 @@ use crate::{ cli::NumberSeparator, info::{ format_number, - git::Commits, - info_field::{InfoField, InfoType}, + utils::git::Commits, + utils::info_field::{InfoField, InfoType}, }, }; use git_repository as git; diff --git a/src/info/repo/commits.rs b/src/info/commits.rs similarity index 95% rename from src/info/repo/commits.rs rename to src/info/commits.rs index ba458c62d..8fcbfc3af 100644 --- a/src/info/repo/commits.rs +++ b/src/info/commits.rs @@ -4,8 +4,8 @@ use crate::{ cli::NumberSeparator, info::{ format_number, - git::Commits, - info_field::{InfoField, InfoType}, + utils::git::Commits, + utils::info_field::{InfoField, InfoType}, }, }; diff --git a/src/info/repo/contributors.rs b/src/info/contributors.rs similarity index 94% rename from src/info/repo/contributors.rs rename to src/info/contributors.rs index 56e3e1c59..cfdca5a51 100644 --- a/src/info/repo/contributors.rs +++ b/src/info/contributors.rs @@ -4,8 +4,8 @@ use crate::{ cli::NumberSeparator, info::{ format_number, - git::Commits, - info_field::{InfoField, InfoType}, + utils::git::Commits, + utils::info_field::{InfoField, InfoType}, }, }; @@ -58,7 +58,7 @@ mod test { #[test] fn test_display_contributors_info() { - use crate::info::git::Commits; + use crate::info::utils::git::Commits; use git_repository::actor::Time; let timestamp = Time::now_utc(); diff --git a/src/info/repo/created.rs b/src/info/created.rs similarity index 89% rename from src/info/repo/created.rs rename to src/info/created.rs index 9d809bea5..e8ae46375 100644 --- a/src/info/repo/created.rs +++ b/src/info/created.rs @@ -1,10 +1,9 @@ -use serde::Serialize; - -use super::gitoxide_time_to_formatted_time; +use super::utils::gitoxide_time_to_formatted_time; use crate::info::{ - git::Commits, - info_field::{InfoField, InfoType}, + utils::git::Commits, + utils::info_field::{InfoField, InfoType}, }; +use serde::Serialize; #[derive(Serialize)] #[serde(rename_all = "camelCase")] diff --git a/src/info/repo/dependencies.rs b/src/info/dependencies.rs similarity index 97% rename from src/info/repo/dependencies.rs rename to src/info/dependencies.rs index 5611ac01e..c1dfd510b 100644 --- a/src/info/repo/dependencies.rs +++ b/src/info/dependencies.rs @@ -2,7 +2,7 @@ use crate::{ cli::NumberSeparator, info::{ format_number, - info_field::{InfoField, InfoType}, + utils::info_field::{InfoField, InfoType}, }, }; use onefetch_manifest::Manifest; diff --git a/src/info/repo/description.rs b/src/info/description.rs similarity index 97% rename from src/info/repo/description.rs rename to src/info/description.rs index 97c95a16b..906843282 100644 --- a/src/info/repo/description.rs +++ b/src/info/description.rs @@ -1,4 +1,4 @@ -use crate::info::info_field::{InfoField, InfoType}; +use crate::info::utils::info_field::{InfoField, InfoType}; use onefetch_manifest::Manifest; use serde::Serialize; use std::fmt::Write; diff --git a/src/info/repo/head.rs b/src/info/head.rs similarity index 97% rename from src/info/repo/head.rs rename to src/info/head.rs index a3c8bb6cb..3810765c0 100644 --- a/src/info/repo/head.rs +++ b/src/info/head.rs @@ -1,4 +1,4 @@ -use crate::info::info_field::{InfoField, InfoType}; +use crate::info::utils::info_field::{InfoField, InfoType}; use anyhow::{Context, Result}; use git_repository::{reference::Category, Reference, Repository}; use serde::Serialize; diff --git a/src/info/langs/language.rs b/src/info/langs/language.rs index f047f2036..bd4bcaf93 100644 --- a/src/info/langs/language.rs +++ b/src/info/langs/language.rs @@ -1,4 +1,4 @@ -use crate::info::info_field::{InfoField, InfoType}; +use crate::info::utils::info_field::{InfoField, InfoType}; use owo_colors::OwoColorize; use serde::Serialize; use tokei; diff --git a/src/info/repo/last_change.rs b/src/info/last_change.rs similarity index 89% rename from src/info/repo/last_change.rs rename to src/info/last_change.rs index 10ec45b23..01188f656 100644 --- a/src/info/repo/last_change.rs +++ b/src/info/last_change.rs @@ -1,10 +1,9 @@ -use serde::Serialize; - -use super::gitoxide_time_to_formatted_time; +use super::utils::gitoxide_time_to_formatted_time; use crate::info::{ - git::Commits, - info_field::{InfoField, InfoType}, + utils::git::Commits, + utils::info_field::{InfoField, InfoType}, }; +use serde::Serialize; #[derive(Serialize)] #[serde(rename_all = "camelCase")] diff --git a/src/info/repo/license.rs b/src/info/license.rs similarity index 98% rename from src/info/repo/license.rs rename to src/info/license.rs index 60c293ec5..6095bf574 100644 --- a/src/info/repo/license.rs +++ b/src/info/license.rs @@ -1,4 +1,4 @@ -use crate::info::info_field::{InfoField, InfoType}; +use crate::info::utils::info_field::{InfoField, InfoType}; use anyhow::{bail, Result}; use askalono::{Store, TextData}; use onefetch_manifest::Manifest; diff --git a/src/info/repo/loc.rs b/src/info/loc.rs similarity index 95% rename from src/info/repo/loc.rs rename to src/info/loc.rs index f3d145ba4..0024903e3 100644 --- a/src/info/repo/loc.rs +++ b/src/info/loc.rs @@ -4,7 +4,7 @@ use crate::{ cli::NumberSeparator, info::{ format_number, - info_field::{InfoField, InfoType}, + utils::info_field::{InfoField, InfoType}, }, }; diff --git a/src/info/mod.rs b/src/info/mod.rs index 854ea2dce..6afcdebef 100644 --- a/src/info/mod.rs +++ b/src/info/mod.rs @@ -1,23 +1,23 @@ -use self::git::Commits; -use self::info_field::{InfoField, InfoType}; +use self::author::AuthorsInfo; +use self::commits::CommitsInfo; +use self::contributors::ContributorsInfo; +use self::created::CreatedInfo; +use self::dependencies::DependenciesInfo; +use self::description::DescriptionInfo; +use self::head::HeadInfo; use self::langs::language::Language; use self::langs::language::LanguagesInfo; -use self::repo::author::AuthorsInfo; -use self::repo::commits::CommitsInfo; -use self::repo::contributors::ContributorsInfo; -use self::repo::created::CreatedInfo; -use self::repo::dependencies::DependenciesInfo; -use self::repo::description::DescriptionInfo; -use self::repo::head::HeadInfo; -use self::repo::last_change::LastChangeInfo; -use self::repo::license::LicenseInfo; -use self::repo::loc::LocInfo; -use self::repo::pending::PendingInfo; -use self::repo::project::ProjectInfo; -use self::repo::size::SizeInfo; -use self::repo::url::UrlInfo; -use self::repo::version::VersionInfo; +use self::last_change::LastChangeInfo; +use self::license::LicenseInfo; +use self::loc::LocInfo; +use self::pending::PendingInfo; +use self::project::ProjectInfo; +use self::size::SizeInfo; use self::title::Title; +use self::url::UrlInfo; +use self::utils::git::Commits; +use self::utils::info_field::{InfoField, InfoType}; +use self::version::VersionInfo; use crate::cli::{is_truecolor_terminal, Config, NumberSeparator, When}; use crate::ui::get_ascii_colors; use crate::ui::text_colors::TextColors; @@ -28,11 +28,24 @@ use owo_colors::{DynColors, OwoColorize, Style}; use serde::Serialize; use std::path::Path; -mod git; -pub mod info_field; +mod author; +mod commits; +mod contributors; +mod created; +mod dependencies; +mod description; +mod head; pub mod langs; -mod repo; -pub mod title; +mod last_change; +mod license; +mod loc; +mod pending; +mod project; +mod size; +mod title; +mod url; +pub mod utils; +mod version; #[derive(Serialize)] #[serde(rename_all = "camelCase")] diff --git a/src/info/repo/pending.rs b/src/info/pending.rs similarity index 97% rename from src/info/repo/pending.rs rename to src/info/pending.rs index 4667b0b98..9866b5a88 100644 --- a/src/info/repo/pending.rs +++ b/src/info/pending.rs @@ -1,4 +1,4 @@ -use crate::info::info_field::{InfoField, InfoType}; +use crate::info::utils::info_field::{InfoField, InfoType}; use anyhow::Result; use git2::{Status, StatusOptions, StatusShow}; use git_repository::Repository; diff --git a/src/info/repo/project.rs b/src/info/project.rs similarity index 99% rename from src/info/repo/project.rs rename to src/info/project.rs index 24cd6c341..e7fa880e9 100644 --- a/src/info/repo/project.rs +++ b/src/info/project.rs @@ -2,7 +2,7 @@ use crate::{ cli::NumberSeparator, info::{ format_number, - info_field::{InfoField, InfoType}, + utils::info_field::{InfoField, InfoType}, }, }; use anyhow::Result; diff --git a/src/info/repo/size.rs b/src/info/size.rs similarity index 98% rename from src/info/repo/size.rs rename to src/info/size.rs index 9af5dec8d..64299dd01 100644 --- a/src/info/repo/size.rs +++ b/src/info/size.rs @@ -2,7 +2,7 @@ use crate::{ cli::NumberSeparator, info::{ format_number, - info_field::{InfoField, InfoType}, + utils::info_field::{InfoField, InfoType}, }, }; use byte_unit::Byte; diff --git a/src/info/repo/url.rs b/src/info/url.rs similarity index 96% rename from src/info/repo/url.rs rename to src/info/url.rs index c4bbfb78b..04844dffa 100644 --- a/src/info/repo/url.rs +++ b/src/info/url.rs @@ -1,4 +1,4 @@ -use crate::info::info_field::{InfoField, InfoType}; +use crate::info::utils::info_field::{InfoField, InfoType}; use anyhow::Result; use git_repository::Repository; use serde::Serialize; diff --git a/src/info/git.rs b/src/info/utils/git.rs similarity index 99% rename from src/info/git.rs rename to src/info/utils/git.rs index 651435fc7..d991ca85b 100644 --- a/src/info/git.rs +++ b/src/info/utils/git.rs @@ -1,5 +1,5 @@ -use super::repo::author::Author; use crate::cli::{MyRegex, NumberSeparator}; +use crate::info::author::Author; use anyhow::Result; use git::bstr::BString; use git_repository as git; diff --git a/src/info/info_field.rs b/src/info/utils/info_field.rs similarity index 100% rename from src/info/info_field.rs rename to src/info/utils/info_field.rs diff --git a/src/info/repo/mod.rs b/src/info/utils/mod.rs similarity index 89% rename from src/info/repo/mod.rs rename to src/info/utils/mod.rs index 3b72a8aa6..743e0f3c9 100644 --- a/src/info/repo/mod.rs +++ b/src/info/utils/mod.rs @@ -2,21 +2,8 @@ use git_repository::actor::Time; use time::{format_description::well_known::Rfc3339, OffsetDateTime}; use time_humanize::HumanTime; -pub mod author; -pub mod commits; -pub mod contributors; -pub mod created; -pub mod dependencies; -pub mod description; -pub mod head; -pub mod last_change; -pub mod license; -pub mod loc; -pub mod pending; -pub mod project; -pub mod size; -pub mod url; -pub mod version; +pub mod git; +pub mod info_field; pub fn gitoxide_time_to_formatted_time(time: Time, iso_time: bool) -> String { if iso_time { diff --git a/src/info/repo/version.rs b/src/info/version.rs similarity index 96% rename from src/info/repo/version.rs rename to src/info/version.rs index 72996104b..fa9ec2111 100644 --- a/src/info/repo/version.rs +++ b/src/info/version.rs @@ -1,4 +1,4 @@ -use crate::info::info_field::{InfoField, InfoType}; +use crate::info::utils::info_field::{InfoField, InfoType}; use anyhow::Result; use git_repository::Repository; use onefetch_manifest::Manifest;