From 5b3ec8a1b047d85888feeb854c3608391b516807 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 12 May 2023 10:46:58 +0530 Subject: [PATCH] fix: replace `pub(crate)` with `pub` --- src/cli.rs | 16 ++++++++-------- src/git.rs | 4 ++-- src/logging.rs | 2 +- src/main.rs | 11 +++++------ src/model.rs | 6 +++--- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index d7c9cc3..4db92de 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -2,32 +2,32 @@ use clap::Parser; #[derive(Parser)] #[command(author, version, about)] -pub(crate) struct Opts { +pub struct Opts { #[command(subcommand)] - pub(crate) subcommand: SubCommand, + pub subcommand: SubCommand, } #[derive(Parser)] -pub(crate) enum SubCommand { +pub enum SubCommand { Freeze(Freeze), Thaw(Thaw), } /// recursively find git repos and record their states into a lockfile #[derive(Parser)] -pub(crate) struct Freeze { +pub struct Freeze { /// directory to search and freeze repos from. - pub(crate) directory: String, + pub directory: String, } /// takes the given lockfile and clones them back into the given directory #[derive(Parser)] -pub(crate) struct Thaw { +pub struct Thaw { /// directory to put cloned repos into. - pub(crate) directory: String, + pub directory: String, /// the lockfile to restore repositories from. #[arg(default_value = "gitice.lock")] - pub(crate) lockfile: String, + pub lockfile: String, } #[cfg(test)] diff --git a/src/git.rs b/src/git.rs index e8c6110..02b724c 100644 --- a/src/git.rs +++ b/src/git.rs @@ -9,7 +9,7 @@ use std::{ }; use walkdir::WalkDir; -pub(crate) fn freeze_repos(dir: &str) -> anyhow::Result<()> { +pub fn freeze_repos(dir: &str) -> anyhow::Result<()> { let mut repos: HashMap = HashMap::new(); for entry in WalkDir::new(dir) .into_iter() @@ -81,7 +81,7 @@ pub(crate) fn freeze_repos(dir: &str) -> anyhow::Result<()> { Ok(()) } -pub(crate) fn thaw_repos(dir: &str, lockfile: &str) -> anyhow::Result<()> { +pub fn thaw_repos(dir: &str, lockfile: &str) -> anyhow::Result<()> { let lockfile = fs::read_to_string(lockfile).context(format!("Failed to read {lockfile}"))?; let repos: HashMap = toml::from_str(&lockfile)?; diff --git a/src/logging.rs b/src/logging.rs index fca64c3..a22cefa 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -10,7 +10,7 @@ fn configure_tracing(filter: Targets) -> Result<(), SetGlobalDefaultError> { set_global_default(subscriber) } -pub(crate) fn init() -> Result<(), SetGlobalDefaultError> { +pub fn init() -> Result<(), SetGlobalDefaultError> { let tracing_filter = Targets::new().with_target("gitice", Level::TRACE); configure_tracing(tracing_filter) } diff --git a/src/main.rs b/src/main.rs index 980d073..a56719f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,12 @@ #![feature(let_chains)] -pub(crate) mod cli; -pub(crate) mod git; -pub(crate) mod logging; -pub(crate) mod model; +pub mod cli; +pub mod git; +pub mod logging; +pub mod model; use clap::Parser; use cli::{Opts, SubCommand}; -use git::freeze_repos; -use git::thaw_repos; +use git::{freeze_repos, thaw_repos}; fn main() -> anyhow::Result<()> { logging::init()?; diff --git a/src/model.rs b/src/model.rs index a732ecc..a8a7926 100644 --- a/src/model.rs +++ b/src/model.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] -pub(crate) struct PersistableRepo { - pub(crate) remote_url: String, - pub(crate) head: String, +pub struct PersistableRepo { + pub remote_url: String, + pub head: String, }