v0.1.1
This commit is contained in:
parent
d2e587cf42
commit
7945e48b79
@ -6,12 +6,12 @@ Location %{s} has been created: 'Location %{s} has been created'
|
||||
The project %{s} has not been found. Do you want to create it?(y/n)[Y]: 'The project %{s} has not been found. Do you want to create it?(y/n)[Y]'
|
||||
Project %{s} has been created. Now you can edit index.md file and create content: 'Project %{s} has been created. Now you can edit index.md file and create content'
|
||||
found... %{s}: 'found... %{s}'
|
||||
msg_08: 'No markdown files found!'
|
||||
msg_09: 'Please edit first your documents in markdown format and come back to convert them to html. Bye!'
|
||||
msg_10: 'Processed markdown files'
|
||||
msg_11: 'Congrats! Check your documentation at.. '
|
||||
msg_12: 'Please consider renaming your main page to index.md and restart the document conversion again. See you later!'
|
||||
err_01: 'Failed to read line'
|
||||
err_02: 'Path not found'
|
||||
err_03: 'The operation failed with error'
|
||||
err_04: 'sed command failed to start'
|
||||
No markdown files found!: 'No markdown files found!'
|
||||
Pleade edit first your documents in markdown format and come back to convert them to html. Bye!: 'Please edit first your documents in markdown format and come back to convert them to html. Bye!'
|
||||
Processed markdown files.. %{s}: 'Processed markdown files.. %{s}'
|
||||
Congrats! Check your documentation at.. %{s}: 'Congrats! Check your documentation at.. %{s}'
|
||||
Please consider renaming your main page to index.md and restart the document conversion again. See you later!: 'Please consider renaming your main page to index.md and restart the document conversion again. See you later!'
|
||||
Failed to read line: 'Failed to read line'
|
||||
Path not found: 'Path not found'
|
||||
The operation failed with error %{s}: 'The operation failed with error %{s}'
|
||||
sed command failed to start: 'sed command failed to start'
|
||||
|
@ -6,12 +6,12 @@ Location %{s} has been created: '%{s} kokapena sortu da'
|
||||
The project %{s} has not been found. Do you want to create it?(y/n)[Y]: '%{s} proiektua ez da aurkitu. Sortu egin nahi duzu?(b/e)[B]'
|
||||
Project %{s} has been created. Now you can edit index.md file and create content: '%{s} proiektua sortu da. Orain index.md fitxategia editatu eta edukiak sor ditzakezu'
|
||||
found... %{s}: 'aurkitua... %{s}'
|
||||
msg_08: 'Ez da markdown fitxategirik aurkitu!'
|
||||
msg_09: 'Mesedez editatu lehenbizi zure dokumentuak markdown formatuan eta itzuli html-ra itzultzeko. Aioo!'
|
||||
msg_10: 'Prozesaturiko markdown fitxategiak'
|
||||
msg_11: 'Zorionak! Ikuskatu zure dokumentazioa hemen.. '
|
||||
msg_12: 'Mesedez berrizendatu zure orri nagusia index.md izenarekin eta saia zaitez berriro. Laster arte!'
|
||||
err_01: 'Akatsa ilara irakurtzean'
|
||||
err_02: 'Ez da bidea aurkitu'
|
||||
err_03: 'Eragiketak ondorengo errorearekin huts egin du'
|
||||
err_04: 'sed komandoak huts egin du abioan'
|
||||
No markdown files found!: 'Ez da markdown fitxategirik aurkitu!'
|
||||
Pleade edit first your documents in markdown format and come back to convert them to html. Bye!: 'Mesedez editatu lehenbizi zure dokumentuak markdown formatuan eta itzuli html-ra itzultzeko. Aioo!'
|
||||
Processed markdown files.. %{s}: 'Prozesaturiko markdown fitxategi kopurua.. %{s}'
|
||||
Congrats! Check your documentation at.. %{s}: 'Zorionak! Ikuskatu zure dokumentazioa hemen.. %{s}'
|
||||
Please consider renaming your main page to index.md and restart the document conversion again. See you later!: 'Mesedez berrizendatu zure orri nagusia index.md izenarekin eta saia zaitez berriro. Laster arte!'
|
||||
Failed to read line: 'Akatsa ilara irakurtzean'
|
||||
Path not found: 'Ez da bidea aurkitu'
|
||||
The operation failed with error %{s}: 'Eragiketak %{s} erroreaz huts egin du'
|
||||
sed command failed to start: 'sed komandoak huts egin du abioan'
|
||||
|
22
src/main.rs
22
src/main.rs
@ -55,7 +55,7 @@ fn main() {
|
||||
doc_path = String::new();
|
||||
let mut input = String::new();
|
||||
println!("{}:", t!("Project name"));
|
||||
io::stdin().read_line(&mut input).expect("Failed to read line");
|
||||
io::stdin().read_line(&mut input).expect(&t!("Failed to read line"));
|
||||
let root = env::var("HOME").unwrap().to_string()+"/";
|
||||
let user_documents_path = dirs::document_dir().unwrap().display().to_string();
|
||||
let user_doc_dir = user_documents_path.split("/").collect::<Vec<_>>().last().unwrap().to_string();
|
||||
@ -63,7 +63,7 @@ fn main() {
|
||||
while !Path::new(&wiki_path).exists() {
|
||||
let mut project_dir = String::new();
|
||||
println!("{}:[{}/Wiki] ", t!("Project location"), &user_doc_dir);
|
||||
io::stdin().read_line(&mut project_dir).expect("Failed to read line");
|
||||
io::stdin().read_line(&mut project_dir).expect(&t!("Failed to read line"));
|
||||
if project_dir.trim().is_empty() { project_dir = String::from(user_doc_dir.clone()+"/Wiki") };
|
||||
wiki_path = root.clone()+project_dir.trim();
|
||||
|
||||
@ -102,7 +102,7 @@ fn main() {
|
||||
let mut ans = String::new();
|
||||
if !Path::new(&doc_path).exists() {
|
||||
println!("{}", t!("The project %{s} has not been found. Do you want to create it?(y/n)[Y]", s = &input.trim().to_owned().green().bold()));
|
||||
io::stdin().read_line(&mut ans).expect("Failed to read line");
|
||||
io::stdin().read_line(&mut ans).expect(&t!("Failed to read line"));
|
||||
}
|
||||
if ans.trim().is_empty() { ans = String::from("Y") };
|
||||
match ans.trim() {
|
||||
@ -110,7 +110,7 @@ fn main() {
|
||||
let _ = mkdir(&doc_path);
|
||||
// create resources
|
||||
for entry in WalkDir::new("assets").into_iter().filter_map(|e| e.ok()) {
|
||||
let input_entry = String::from(entry.path().strip_prefix("assets").expect("Path not found").display().to_string());
|
||||
let input_entry = String::from(entry.path().strip_prefix("assets").expect(&t!("Path not found")).display().to_string());
|
||||
let subdirs = wiki_path.to_string()+"/"+&input_entry;
|
||||
let images = wiki_path.to_string()+"/"+&doc_title.trim()+"/"+&input_entry;
|
||||
|
||||
@ -153,7 +153,7 @@ fn main() {
|
||||
|
||||
let res = processing(Project::new(wiki_path.clone(), doc_path.clone(), doc_title, output_dir));
|
||||
match res {
|
||||
Err(e) => println!("The operation failed with error: {}", e),
|
||||
Err(e) => println!("{}", t!("The operation failed with error %{s}", s = e)),
|
||||
Ok(e) => println!("{}", e)
|
||||
};
|
||||
}
|
||||
@ -219,17 +219,17 @@ fn processing(project: Project) -> Result<String, String>{
|
||||
|
||||
if error.is_empty() {
|
||||
if md_count == 0 {
|
||||
println!("No markdown files found!");
|
||||
println!("Pleade edit first your documents in markdown format and come back to convert them to html. Bye!");
|
||||
println!("{}", t!("No markdown files found!"));
|
||||
println!("{}", t!("Pleade edit first your documents in markdown format and come back to convert them to html. Bye!"));
|
||||
}else{
|
||||
println!("Processed {} markdown files.", md_count);
|
||||
println!("{}", t!("Processed markdown files.. %{s}", s = md_count));
|
||||
}
|
||||
let mut index = project.wiki_path.to_owned()+"/"+&project.output_dir.trim_end();
|
||||
index.push_str("/index.html");
|
||||
sanitize(Path::new(&index));
|
||||
//Ok("Success")
|
||||
let link = String::from("file://".to_owned()+&index).cyan();
|
||||
let message:String = String::from("Congrats! Check your documentation at.. ".to_owned()+&link);
|
||||
let message:String = String::from(t!("Congrats! Check your documentation at.. %{s}", s = &link));
|
||||
Ok(message)
|
||||
}else{
|
||||
//Err(std::stringify!(error))
|
||||
@ -279,9 +279,9 @@ fn sanitize(index: &Path){
|
||||
Command::new("sed")
|
||||
.args(["-i", r"-e s/\.md/\.html/g", &index.display().to_string()])
|
||||
.status()
|
||||
.expect("sed command failed start");
|
||||
.expect(&t!("sed command failed start"));
|
||||
}else{
|
||||
println!("Please consider renaming your main page to index.md and restart the document conversion again. See you later!")
|
||||
println!("{}", t!("Please consider renaming your main page to index.md and restart the document conversion again. See you later!"));
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user