Skip to content

Commit

Permalink
删除不必要的文件
Browse files Browse the repository at this point in the history
  • Loading branch information
fankaiLiu committed Jan 21, 2025
1 parent e265201 commit 56fd615
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
4 changes: 4 additions & 0 deletions src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ pub fn orange<S: AsRef<str>>(msg: S) {
pub fn green<S: AsRef<str>>(msg: S) {
println!("{}", Green.paint(msg.as_ref()));
}

pub fn gray<S: AsRef<str>>(msg: S) {
println!("{}", Colour::RGB(128, 128, 128).paint(msg.as_ref()));
}
9 changes: 4 additions & 5 deletions src/templates/classic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ use std::fs::{self, File};
use std::io::Write;
use std::path::Path;

use crate::printer::{gray, warning};
use crate::{git, Project};
use anyhow::Result;
use liquid::model::Object;
use rust_i18n::t;

use crate::printer::{success, warning};
use crate::{git, Project};

pub(crate) mod selection;
use selection::Selected;

Expand Down Expand Up @@ -121,7 +120,7 @@ pub(crate) fn create_files(project_path: &Path, selected: Selected, proj: &Proje
let file_path = project_path.join(filename.as_ref().trim_start_matches("_base/"));
write_file(&file.data, &file_path, &data)?;
} else if filename.starts_with("_data/") {
if filename.contains(db_lib_str) && filename.contains(db_lib_str) {
if filename.contains(db_lib_str) && filename.contains(".sqlite") && db_type == "sqlite" {
let file = Template::get(filename.as_ref()).expect("file must exist");
let file_path = project_path.join(filename.as_ref().trim_start_matches("_"));
write_file(&file.data, &file_path, &data)?;
Expand All @@ -146,7 +145,7 @@ fn write_file(tmpl: &[u8], file_path: &Path, data: &Object) -> Result<()> {
}
if file_path.extension() == Some(OsStr::new("liquid")) {
let msg = t!("rendering_liquid_file").replace(r"\n", "\n") + &format!(" {:?}", file_path);
success(msg);
gray(msg);
let template = liquid::ParserBuilder::with_stdlib()
.build()
.expect("should create liquid parser")
Expand Down
13 changes: 0 additions & 13 deletions templates/classic/_data/init.sql.liquid

This file was deleted.

0 comments on commit 56fd615

Please sign in to comment.