Added new flag '--all/-a' for Ls, also refactor some code (#1483)

* Utility function to detect hidden folders.
Implemented for Unix and Windows.

* Rename function argument.

* Revert "Rename function argument."

This reverts commit e7ab70f0f0.

* Add flag '--all/-a' to Ls

* Rename function argument.

* Check if flag '--all/-a' is present and path is hidden.
Replace match with map_err for glob result.
Remove redundancy in stream body.
Included comments on new stream body.
Replace async_stream::stream with async_stream::try_stream.
Minor tweaks to is_empty_dir.
Fix and refactor is_hidden_dir.

* Fix "implicit" bool coerse

* Fixed clippy errors
This commit is contained in:
Kevin DCR
2020-03-13 12:27:04 -05:00
committed by GitHub
parent 5ca9e12b7f
commit b6363f3ce1
7 changed files with 80 additions and 40 deletions

View File

@ -137,7 +137,7 @@ pub struct ExpandContext<'context> {
impl<'context> ExpandContext<'context> {
pub(crate) fn homedir(&self) -> Option<&Path> {
self.homedir.as_ref().map(|h| h.as_path())
self.homedir.as_deref()
}
pub(crate) fn source(&self) -> &'context Text {

View File

@ -372,7 +372,7 @@ fn word<'a, T, U, V>(
let (input, _) = start_predicate(input)?;
let (input, _) = many0(next_predicate)(input)?;
let next_char = &input.fragment.chars().nth(0);
let next_char = &input.fragment.chars().next();
match next_char {
Some('.') => {}
@ -609,7 +609,7 @@ fn tight<'a>(
let (input, tail) = opt(alt((many1(range_continuation), many1(dot_member))))(input)?;
let next_char = &input.fragment.chars().nth(0);
let next_char = &input.fragment.chars().next();
if is_boundary(*next_char) {
if let Some(tail) = tail {