Skip to content

Commit 4b6fc53

Browse files
committed
added displaying files by names that are not in the current directory
1 parent 7675ba0 commit 4b6fc53

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "natls"
3-
version = "2.1.7"
3+
version = "2.1.8"
44
authors = ["Will Lane <[email protected]>"]
55
description = "nat - the 'ls' replacement you never knew you needed"
66
license = "MIT"

snapcraft.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: natls
2-
version: '2.1.6'
2+
version: '2.1.8'
33
summary: the 'ls' replacement you never knew you needed
44
description: |
55
Nat is a complete replacement for the 'ls' command

src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ fn get_sort_type(sort_t: [bool; 4]) -> DirSortType {
125125

126126
impl Directory {
127127
fn new(dir: std::path::PathBuf) -> Result<Self, Box<dyn std::error::Error>> {
128+
if !std::path::Path::new(&dir).is_dir() {
129+
let f = File::new(dir.clone());
130+
match input::Cli::from_args().long {
131+
true => print!("{:?}", f),
132+
_ => print!("{}", f)
133+
}
134+
std::process::exit(0)
135+
}
128136
if !std::path::Path::new(&dir).exists() {
129137
let mut new_paths = Vec::new();
130138
let paths = std::fs::read_dir(".")?

0 commit comments

Comments
 (0)