mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-25 13:27:33 +00:00
Make some options fields private
This commit is contained in:
parent
1c5409e253
commit
d93bca8779
11
src/exa.rs
11
src/exa.rs
@ -42,10 +42,14 @@ fn exa(opts: &Options) {
|
||||
let mut dirs: Vec<String> = vec![];
|
||||
let mut files: Vec<File> = vec![];
|
||||
|
||||
// It's only worth printing out directory names if the user supplied
|
||||
// more than one of them.
|
||||
let mut print_dir_names = false;
|
||||
|
||||
// Separate the user-supplied paths into directories and files.
|
||||
// Files are shown first, and then each directory is expanded
|
||||
// and listed second.
|
||||
for file in opts.path_strs.iter() {
|
||||
for file in opts.path_strings() {
|
||||
let path = Path::new(file);
|
||||
match fs::stat(&path) {
|
||||
Ok(stat) => {
|
||||
@ -60,11 +64,10 @@ fn exa(opts: &Options) {
|
||||
}
|
||||
Err(e) => println!("{}: {}", file, e),
|
||||
}
|
||||
|
||||
print_dir_names = true;
|
||||
}
|
||||
|
||||
// It's only worth printing out directory names if the user supplied
|
||||
// more than one of them.
|
||||
let print_dir_names = opts.path_strs.len() > 1;
|
||||
let mut first = files.is_empty();
|
||||
|
||||
if !files.is_empty() {
|
||||
|
@ -7,6 +7,7 @@ use column::Column::*;
|
||||
use term::dimensions;
|
||||
|
||||
use std::ascii::AsciiExt;
|
||||
use std::slice::Iter;
|
||||
|
||||
pub enum SortField {
|
||||
Unsorted, Name, Extension, Size, FileInode
|
||||
@ -36,10 +37,10 @@ pub enum View {
|
||||
pub struct Options {
|
||||
pub header: bool,
|
||||
pub list_dirs: bool,
|
||||
pub path_strs: Vec<String>,
|
||||
pub reverse: bool,
|
||||
pub show_invisibles: bool,
|
||||
pub sort_field: SortField,
|
||||
path_strs: Vec<String>,
|
||||
reverse: bool,
|
||||
show_invisibles: bool,
|
||||
sort_field: SortField,
|
||||
pub view: View,
|
||||
}
|
||||
|
||||
@ -87,6 +88,10 @@ impl Options {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn path_strings(&self) -> Iter<String> {
|
||||
self.path_strs.iter()
|
||||
}
|
||||
|
||||
fn view(matches: &getopts::Matches) -> View {
|
||||
if matches.opt_present("long") {
|
||||
View::Details(Options::columns(matches))
|
||||
|
Loading…
Reference in New Issue
Block a user