|
|
@@ -65,12 +65,15 @@ fn main() {
|
|
|
let args: Vec<_> = env::args_os().skip(1).collect();
|
|
|
match Options::parse(args.iter().map(std::convert::AsRef::as_ref), &LiveVars) {
|
|
|
OptionsResult::Ok(options, mut input_paths) => {
|
|
|
+ let mut default_input_path = false;
|
|
|
+
|
|
|
// List the current directory by default.
|
|
|
// (This has to be done here, otherwise git_options won’t see it.)
|
|
|
if input_paths.is_empty() {
|
|
|
match &options.stdin {
|
|
|
FilesInput::Args => {
|
|
|
input_paths = vec![OsStr::new(".")];
|
|
|
+ default_input_path = true;
|
|
|
}
|
|
|
FilesInput::Stdin(separator) => {
|
|
|
stdin()
|
|
|
@@ -97,6 +100,7 @@ fn main() {
|
|
|
options,
|
|
|
writer,
|
|
|
input_paths,
|
|
|
+ default_input_path,
|
|
|
theme,
|
|
|
console_width,
|
|
|
git,
|
|
|
@@ -155,6 +159,10 @@ pub struct Exa<'args> {
|
|
|
/// names (anything that isn’t an option).
|
|
|
pub input_paths: Vec<&'args OsStr>,
|
|
|
|
|
|
+ /// If no path has been passed through with the command line, and the
|
|
|
+ /// `input_paths` field has been filled with "." by default
|
|
|
+ pub default_input_path: bool,
|
|
|
+
|
|
|
/// The theme that has been configured from the command-line options and
|
|
|
/// environment variables. If colours are disabled, this is a theme with
|
|
|
/// every style set to the default.
|
|
|
@@ -277,7 +285,9 @@ impl<'args> Exa<'args> {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if f.points_to_directory() && !self.options.dir_action.treat_dirs_as_files() {
|
|
|
+ if f.points_to_directory()
|
|
|
+ && (self.default_input_path || !self.options.dir_action.treat_dirs_as_files())
|
|
|
+ {
|
|
|
trace!("matching on to_dir");
|
|
|
match f.to_dir() {
|
|
|
Ok(d) => dirs.push(d),
|