mirror of
https://github.com/numtide/treefmt.git
synced 2024-10-03 20:18:11 +03:00
chore: move cli commands to binary crate
This commit is contained in:
parent
5deccb7897
commit
2aa7dc2d66
@ -1,8 +1,8 @@
|
||||
use crate::engine::run_treefmt;
|
||||
use anyhow::anyhow;
|
||||
use directories::ProjectDirs;
|
||||
use log::debug;
|
||||
use std::path::{Path, PathBuf};
|
||||
use treefmt::engine::run_treefmt;
|
||||
|
||||
pub fn format_cmd(
|
||||
tree_root: &Option<PathBuf>,
|
@ -1,10 +1,8 @@
|
||||
use crate::config;
|
||||
use crate::engine::run_treefmt_stdin;
|
||||
use crate::expand_path;
|
||||
use anyhow::anyhow;
|
||||
use directories::ProjectDirs;
|
||||
use log::debug;
|
||||
use std::path::{Path, PathBuf};
|
||||
use treefmt::{config, engine::run_treefmt_stdin, expand_path};
|
||||
|
||||
pub fn format_stdin_cmd(
|
||||
tree_root: &Option<PathBuf>,
|
@ -1,9 +1,8 @@
|
||||
use crate::config;
|
||||
use anyhow::Context;
|
||||
use console::style;
|
||||
use log::info;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::{fs, path::Path};
|
||||
use treefmt::config;
|
||||
|
||||
pub fn init_cmd(work_dir: &Path) -> anyhow::Result<()> {
|
||||
let file_path = work_dir.join(config::FILENAME);
|
@ -8,8 +8,6 @@ mod init;
|
||||
use self::format::format_cmd;
|
||||
use self::format_stdin::format_stdin_cmd;
|
||||
use self::init::init_cmd;
|
||||
use crate::config;
|
||||
use crate::expand_path;
|
||||
use anyhow::anyhow;
|
||||
use clap::Parser;
|
||||
use clap_verbosity_flag::Verbosity;
|
||||
@ -17,6 +15,7 @@ use std::{
|
||||
env,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use treefmt::{config, expand_path};
|
||||
|
||||
/// ✨ format all your language!
|
||||
#[derive(Parser, Debug)]
|
10
src/lib.rs
10
src/lib.rs
@ -1,7 +1,5 @@
|
||||
//! Your favorite all-in-one formatter tool!
|
||||
|
||||
#![deny(missing_docs)]
|
||||
pub mod command;
|
||||
pub mod config;
|
||||
pub mod engine;
|
||||
pub mod eval_cache;
|
||||
@ -11,9 +9,11 @@ use anyhow::Result;
|
||||
use filetime::FileTime;
|
||||
use path_clean::PathClean;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::env;
|
||||
use std::fs::Metadata;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{
|
||||
env,
|
||||
fs::Metadata,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use which::which_in;
|
||||
|
||||
/// FileMeta represents file meta that change on file modification
|
||||
|
@ -1,7 +1,9 @@
|
||||
#![allow(clippy::redundant_closure, clippy::redundant_pattern_matching)]
|
||||
|
||||
mod cli;
|
||||
|
||||
use crate::cli::{cli_from_args, run_cli};
|
||||
use log::error;
|
||||
use treefmt::command::{cli_from_args, run_cli};
|
||||
|
||||
fn main() {
|
||||
if let Err(e) = run() {
|
||||
|
Loading…
Reference in New Issue
Block a user