mirror of https://github.com/msfjarvis/gitice.git
fix: replace `pub(crate)` with `pub`
This commit is contained in:
parent
a728a353d6
commit
5b3ec8a1b0
16
src/cli.rs
16
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)]
|
||||
|
|
|
@ -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<String, PersistableRepo> = 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<String, PersistableRepo> = toml::from_str(&lockfile)?;
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
11
src/main.rs
11
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()?;
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue