mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-23 15:37:51 -08:00
Merge pull request #821 from AnthonyMichaelTDM/main
update markdown_todo_rust
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
use std::ffi::{OsString, OsStr};
|
use std::ffi::OsStr;
|
||||||
use std::{fs, io};
|
use std::{fs, io};
|
||||||
use std::fs::metadata;
|
use std::fs::metadata;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
@@ -8,8 +8,6 @@ use std::path::{Path, PathBuf};
|
|||||||
* @author Anthony Rubick
|
* @author Anthony Rubick
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//DATA
|
//DATA
|
||||||
const ROOT_DIR: &str = "../../";
|
const ROOT_DIR: &str = "../../";
|
||||||
const LANGUAGES: [(&str,&str); 10] = [ //first element of tuple is the language name, second element is the file extension
|
const LANGUAGES: [(&str,&str); 10] = [ //first element of tuple is the language name, second element is the file extension
|
||||||
@@ -25,13 +23,19 @@ const LANGUAGES: [(&str,&str); 10] = [ //first element of tuple is the language
|
|||||||
("vbnet", "vb")
|
("vbnet", "vb")
|
||||||
];
|
];
|
||||||
const OUTPUT_PATH: &str = "../../todo.md";
|
const OUTPUT_PATH: &str = "../../todo.md";
|
||||||
//const INGORE: [&str;5] = ["../../.git","../../.vscode","../../00_Utilities","../../buildJvm","../../node_modules"]; //folders to ignore
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
//DATA
|
//DATA
|
||||||
let mut root_folders:Vec<PathBuf>;
|
let mut root_folders:Vec<PathBuf>;
|
||||||
let mut output_string: String = String::new();
|
let mut output_string: String = String::new();
|
||||||
let format_game_first: bool;
|
let format_game_first: bool;
|
||||||
|
let ingore: [PathBuf;5] = [
|
||||||
|
PathBuf::from(r"../../.git"),
|
||||||
|
PathBuf::from(r"../../.github"),
|
||||||
|
PathBuf::from(r"../../00_Alternate_Languages"),
|
||||||
|
PathBuf::from(r"../../00_Utilities"),
|
||||||
|
PathBuf::from(r"../../00_Common"),
|
||||||
|
]; //folders to ignore
|
||||||
|
|
||||||
//print welcome message
|
//print welcome message
|
||||||
println!("
|
println!("
|
||||||
@@ -66,15 +70,10 @@ fn main() {
|
|||||||
|
|
||||||
//for all folders, search for the languages and extensions
|
//for all folders, search for the languages and extensions
|
||||||
root_folders = root_folders.into_iter().filter(|path| {
|
root_folders = root_folders.into_iter().filter(|path| {
|
||||||
match fs::read_dir(path) {
|
//not one of the ignored folders
|
||||||
Err(why) => {println!("! {:?}", why.kind()); false},
|
!ingore.contains(path)
|
||||||
Ok(paths) => {
|
|
||||||
paths.into_iter().filter(|f| metadata(f.as_ref().unwrap().path()).unwrap().is_dir()) //filter to only folders
|
|
||||||
.filter_map( |path| path.ok() ) //extract only the DirEntries
|
|
||||||
.any(|f| LANGUAGES.iter().any(|tup| OsString::from(tup.1).eq_ignore_ascii_case(f.file_name()))) //filter out ones that don't contain folders with the language names
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).collect();
|
}).collect();
|
||||||
|
root_folders.sort();
|
||||||
|
|
||||||
//create todo list
|
//create todo list
|
||||||
if format_game_first {
|
if format_game_first {
|
||||||
|
|||||||
Reference in New Issue
Block a user