Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use dns_common library #818

Merged
merged 4 commits into from
Apr 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 186 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ edit = "0.1.4"
remove_dir_all = "0.8.2"
serde = { version = "1.0.159", features = ["derive"] }
serde_yaml = "0.9.21"
dns_common_derive = { version = "0.2.1" }
dns_common = { version = "0.2.1", default-features = false, features = ["yaml", "json"] }

[lib]
name = "navi"
Expand Down
10 changes: 1 addition & 9 deletions src/common/fs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::prelude::*;
use crate::prelude::*;
use remove_dir_all::remove_dir_all;
use std::ffi::OsStr;
use std::fs::{self, create_dir_all, File};
Expand All @@ -21,14 +21,6 @@ impl ToStringExt for OsStr {
}
}

// pub fn config_dir(project_name: &str) -> Result<PathBuf> {
// let base_dirs = BaseDirs::new().context("unable to get base dirs")?;
//
// let mut pathbuf = PathBuf::from(base_dirs.config_dir());
// pathbuf.push(project_name);
// Ok(pathbuf)
// }

#[derive(Error, Debug)]
#[error("Invalid path `{0}`")]
pub struct InvalidPath(pub PathBuf);
Expand Down
6 changes: 0 additions & 6 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// pub mod component;
// pub mod deps;
// pub mod deser;
pub mod clipboard;
pub mod fs;
pub mod git;
pub mod hash;
pub mod prelude;
pub mod shell;
pub mod terminal;
pub mod url;
// pub mod system;
// pub mod tracing;
29 changes: 0 additions & 29 deletions src/common/prelude.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/config/cli.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::commands;
use crate::finder::FinderChoice;
use crate::prelude::*;

use clap::{crate_version, Parser, Subcommand};

#[derive(Debug, Parser)]
Expand Down
7 changes: 4 additions & 3 deletions src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
pub use crate::common::prelude::*;
pub use crate::config::CONFIG; // TODO
pub use dns_common::prelude::*;
pub use regex::Regex;

// pub use crate::common::fs::pathbuf_to_string; // TODO
pub use std::io::{BufRead, BufReader};
pub use std::process::Stdio;
pub use std::str::FromStr;

pub trait Runnable {
fn run(&self) -> Result<()>;
Expand Down