partial view

This commit is contained in:
45Tatami 2024-04-29 18:43:13 +02:00
parent d17266dc2e
commit 3f41fd6f95
1 changed files with 28 additions and 2 deletions

View File

@ -11,7 +11,9 @@ use clap::{Parser, Subcommand};
use walkdir::WalkDir;
use std::fs::DirEntry;
use std::env::temp_dir;
use std::fs::{create_dir, DirEntry};
use std::os::unix::fs::symlink;
use std::path::{Path, PathBuf};
use env_logger::Env;
@ -47,7 +49,9 @@ enum Commands {
path: PathBuf
},
List
List,
View,
}
#[derive(Subcommand)]
@ -123,5 +127,27 @@ fn main() {
println!("{f:?}");
}
}
Commands::View => {
let dir_root = temp_dir();
let mut num = 1;
let mut num_string: String;
let mut path;
loop {
num_string = num.to_string();
path = dir_root.clone().into_os_string().into_string().unwrap() + "/" + &num_string;
if create_dir(path.clone()).is_ok() {
break
};
num += 1;
}
let files = database.get_all_files(cli.repo);
for f in files {
let _ = symlink(f.path, path.clone());
}
println!("{}", path);
}
};
}