Skip to content

Commit 113fa9b

Browse files
authored
Merge branch 'main' into p-git_repos
2 parents 3f1e5ef + 86ad527 commit 113fa9b

40 files changed

+471
-241
lines changed

.github/workflows/apt.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Apt Installation
2+
on:
3+
schedule:
4+
- cron: '0 0 * * *'
5+
push:
6+
branches: [ main ]
7+
paths:
8+
- 'deb.asc'
9+
- '.github/workflows/apt.yml'
10+
pull_request:
11+
branches: [ main ]
12+
paths:
13+
- 'deb.asc'
14+
- '.github/workflows/apt.yml'
15+
jobs:
16+
apt_installation:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Install eza via apt repo
20+
run: |
21+
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo tee /etc/apt/trusted.gpg.d/gierens.asc && \
22+
echo "deb http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list && \
23+
sudo apt update && \
24+
sudo apt install -y eza
25+
- name: Run eza
26+
run: eza
27+
- name: Open man page
28+
run: man eza | cat
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Conventional Commits
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
name: Conventional Commits
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- uses: webiny/[email protected]
17+
# optional, required for private repos
18+
# with:
19+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/unit-tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ on:
44
push:
55
branches: [ main ]
66
paths:
7-
- '.github/workflows/*'
7+
- '.github/workflows/unit-tests.yml'
88
- 'src/**'
99
- 'Cargo.*'
1010
- build.rs
1111
pull_request:
1212
branches: [ main ]
1313
paths:
14-
- '.github/workflows/*'
14+
- '.github/workflows/unit-tests.yml'
1515
- 'src/**'
1616
- 'Cargo.*'
1717
- build.rs

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,36 @@ On Gentoo, eza is available as a package [`sys-apps/eza`](https://packages.gento
141141
emerge --ask sys-apps/eza
142142
```
143143

144+
### openSUSE
145+
146+
Eza is available at [openSUSE:Factory/eza](https://build.opensuse.org/package/show/openSUSE:Factory/eza):
147+
148+
```bash
149+
zypper ar https://download.opensuse.org/tumbleweed/repo/oss/ factory-oss
150+
zypper in eza
151+
```
152+
153+
The preceding repository also contains the Bash, Fish, and Zsh completions.
154+
155+
### Fedora
156+
157+
You can install Eza from [openSUSE:Factory/eza](https://build.opensuse.org/package/show/openSUSE:Factory/eza):
158+
159+
```bash
160+
tee /etc/yum.repos.d/opensuse-tumbleweed-oss.repo <<EOL
161+
[opensuse-tumbleweed-oss]
162+
name=OpenSUSE Tumbleweed OSS
163+
baseurl=https://download.opensuse.org/tumbleweed/repo/oss/
164+
enabled=1
165+
gpgcheck=1
166+
gpgkey=https://download.opensuse.org/tumbleweed/repo/oss/repodata/repomd.xml.key
167+
EOL
168+
169+
dnf install eza
170+
```
171+
172+
The preceding repository also contains the Bash, Fish, and Zsh completions.
173+
144174
### Brew (MacOS)
145175

146176
[![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/eza.svg)](https://repology.org/project/eza/versions)
@@ -166,6 +196,19 @@ To install eza, run:
166196
sudo port install eza
167197
```
168198

199+
### Scoop (Windows)
200+
201+
[![Windows package](https://repology.org/badge/version-for-repo/scoop/eza.svg)](https://repology.org/project/eza/versions)
202+
203+
204+
Eza is available from [Scoop](https://scoop.sh/#/apps?q=eza&id=a52070d25f94bbcc884f80bef53eb47ed1268198).
205+
206+
To install eza, run:
207+
208+
```shell
209+
scoop install eza
210+
```
211+
169212
---
170213
Click sections to expand.
171214

completions/bash/eza

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ _eza()
3838
# _parse_help doesn’t pick up short options when they are on the same line than long options
3939
--*)
4040
# colo[u]r isn’t parsed correctly so we filter these options out and add them by hand
41-
parse_help=$( eza --help | grep -oE ' (\-\-[[:alnum:]@-]+)' | tr -d ' ' | grep -v '\-\-colo' )
41+
parse_help=$( eza --help | grep -oE ' (--[[:alnum:]@-]+)' | tr -d ' ' | grep -v '\--colo' )
4242
completions=$( echo '--color --colour --color-scale --colour-scale' $parse_help )
4343
COMPREPLY=( $( compgen -W "$completions" -- "$cur" ) )
4444
;;
4545

4646
-*)
47-
completions=$( eza --help | grep -oE ' (\-[[:alnum:]@])' | tr -d ' ' )
47+
completions=$( eza --help | grep -oE ' (-[[:alnum:]@])' | tr -d ' ' )
4848
COMPREPLY=( $( compgen -W "$completions" -- "$cur" ) )
4949
;;
5050

devtools/deb-package.sh

+36-36
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ TAG=$(git describe --tags --abbrev=0)
99
VERSION=${TAG:1}
1010

1111
echo "checkout tag ${TAG}"
12-
git checkout --quiet ${TAG}
12+
git checkout --quiet "${TAG}"
1313

1414
echo "build man pages"
1515
just man
@@ -20,7 +20,7 @@ TARGETS["arm64"]="aarch64-unknown-linux-gnu"
2020
TARGETS["armhf"]="arm-unknown-linux-gnueabihf"
2121

2222
echo "download release notes"
23-
RELEASE_NOTES=$(curl -s ${REPO_URL}/releases/tag/${TAG})
23+
RELEASE_NOTES=$(curl -s "${REPO_URL}/releases/tag/${TAG}")
2424

2525
for ARCH in "${!TARGETS[@]}"; do
2626
echo "building ${ARCH} package:"
@@ -40,29 +40,29 @@ for ARCH in "${!TARGETS[@]}"; do
4040
echo " checksum ok"
4141

4242
echo " -> creating directory structure"
43-
mkdir -p ${DEB_TMP_DIR}
44-
mkdir -p ${DEB_TMP_DIR}${DESTDIR}
45-
mkdir -p ${DEB_TMP_DIR}${DOCDIR}
46-
mkdir -p ${DEB_TMP_DIR}${DOCDIR}/man1
47-
mkdir -p ${DEB_TMP_DIR}${DOCDIR}/man5
48-
mkdir -p ${DEB_TMP_DIR}/DEBIAN
49-
mkdir -p ${DEB_TMP_DIR}/usr/share/doc/${NAME}
50-
chmod 755 -R ${DEB_TMP_DIR}
51-
43+
mkdir -p "${DEB_TMP_DIR}"
44+
mkdir -p "${DEB_TMP_DIR}${DESTDIR}"
45+
mkdir -p "${DEB_TMP_DIR}${DOCDIR}"
46+
mkdir -p "${DEB_TMP_DIR}${DOCDIR}/man1"
47+
mkdir -p "${DEB_TMP_DIR}${DOCDIR}/man5"
48+
mkdir -p "${DEB_TMP_DIR}/DEBIAN"
49+
mkdir -p "${DEB_TMP_DIR}/usr/share/doc/${NAME}"
50+
chmod 755 -R "${DEB_TMP_DIR}"
51+
5252
echo " -> extract executable"
5353
tar -xzf "${ARCH}.tar.gz"
54-
cp ${NAME} ${DEB_TMP_DIR}${DESTDIR}
55-
chmod 755 ${DEB_TMP_DIR}${DESTDIR}/${NAME}
54+
cp ${NAME} "${DEB_TMP_DIR}${DESTDIR}"
55+
chmod 755 "${DEB_TMP_DIR}${DESTDIR}/${NAME}"
5656

5757
echo " -> compress man pages"
58-
gzip -cn9 target/man/eza.1 > ${DEB_TMP_DIR}${DOCDIR}man1/eza.1.gz
59-
gzip -cn9 target/man/eza_colors.5 > ${DEB_TMP_DIR}${DOCDIR}man5/eza_colors.5.gz
60-
gzip -cn9 target/man/eza_colors-explanation.5 > ${DEB_TMP_DIR}${DOCDIR}man5/eza_colors-explanation.5.gz
61-
chmod 644 ${DEB_TMP_DIR}${DOCDIR}/**/*.gz
62-
58+
gzip -cn9 target/man/eza.1 > "${DEB_TMP_DIR}${DOCDIR}man1/eza.1.gz"
59+
gzip -cn9 target/man/eza_colors.5 > "${DEB_TMP_DIR}${DOCDIR}man5/eza_colors.5.gz"
60+
gzip -cn9 target/man/eza_colors-explanation.5 > "${DEB_TMP_DIR}${DOCDIR}man5/eza_colors-explanation.5.gz"
61+
chmod 644 "${DEB_TMP_DIR}${DOCDIR}"/**/*.gz
62+
6363
echo " -> create control file"
64-
touch ${DEB_TMP_DIR}/DEBIAN/control
65-
cat > ${DEB_TMP_DIR}/DEBIAN/control <<EOM
64+
touch "${DEB_TMP_DIR}/DEBIAN/control"
65+
cat > "${DEB_TMP_DIR}/DEBIAN/control" <<EOM
6666
Package: ${NAME}
6767
Version: ${VERSION}
6868
Section: utils
@@ -78,17 +78,17 @@ Description: Modern replacement for ls
7878
It also has extra features not present in the original ls, such as viewing the
7979
Git status for a directory, or recursing into directories with a tree view.
8080
EOM
81-
chmod 644 ${DEB_TMP_DIR}/DEBIAN/control
82-
81+
chmod 644 "${DEB_TMP_DIR}/DEBIAN/control"
82+
8383
echo " -> copy changelog"
84-
cp CHANGELOG.md ${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog
85-
gzip -cn9 ${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog > ${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog.gz
86-
rm ${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog
87-
chmod 644 ${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog.gz
88-
84+
cp CHANGELOG.md "${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog"
85+
gzip -cn9 "${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog" > "${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog.gz"
86+
rm "${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog"
87+
chmod 644 "${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog.gz"
88+
8989
echo " -> create copyright file"
90-
touch ${DEB_TMP_DIR}/usr/share/doc/${NAME}/copyright
91-
cat > ${DEB_TMP_DIR}/usr/share/doc/${NAME}/copyright << EOM
90+
touch "${DEB_TMP_DIR}/usr/share/doc/${NAME}/copyright"
91+
cat > "${DEB_TMP_DIR}/usr/share/doc/${NAME}/copyright" << EOM
9292
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
9393
Upstream-Name: ${NAME}
9494
Upstream-Contact: Christina Sørensen <[email protected]>
@@ -121,16 +121,16 @@ License: MIT
121121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
122122
SOFTWARE.
123123
EOM
124-
chmod 644 ${DEB_TMP_DIR}/usr/share/doc/${NAME}/copyright
125-
124+
chmod 644 "${DEB_TMP_DIR}/usr/share/doc/${NAME}/copyright"
125+
126126
echo " -> build ${ARCH} package"
127-
dpkg-deb --build --root-owner-group ${DEB_TMP_DIR} > /dev/null
128-
127+
dpkg-deb --build --root-owner-group "${DEB_TMP_DIR}" > /dev/null
128+
129129
echo " -> cleanup"
130-
rm -rf ${DEB_TMP_DIR} ${ARCH}.tar.gz ${NAME}
131-
130+
rm -rf "${DEB_TMP_DIR}" "${ARCH}.tar.gz" "${NAME}"
131+
132132
# gierens: this does not work on my arch at the moment and
133133
# i'm verifying on the repo host anyway thus the || true
134134
echo " -> lint ${ARCH} package"
135-
lintian ${DEB_PACKAGE} || true
135+
lintian "${DEB_PACKAGE}" || true
136136
done

flake.nix

+4-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
singleStep = true;
121121
# set itests files creation date to unix epoch
122122
buildPhase = ''touch --date=@0 tests/itest/*'';
123-
cargoTestOptions = opts: opts ++ [ "--features nix" ];
123+
cargoTestOptions = opts: opts ++ ["--features nix"];
124124
inherit buildInputs;
125125
};
126126

@@ -135,8 +135,8 @@
135135
singleStep = true;
136136
# set itests files creation date to unix epoch
137137
buildPhase = ''touch --date=@0 tests/itest/*; rm tests/cmd/*.stdout || echo; rm tests/cmd/*.stderr || echo;'';
138-
cargoTestOptions = opts: opts ++ [ "--features nix" ];
139-
TRYCMD="dump";
138+
cargoTestOptions = opts: opts ++ ["--features nix"];
139+
TRYCMD = "dump";
140140
postInstall = ''
141141
cp dump $out -r
142142
'';
@@ -155,6 +155,7 @@
155155
build = packages.check;
156156
test = packages.test;
157157
lint = packages.clippy;
158+
trycmd = packages.trycmd;
158159
};
159160
}
160161
);

src/fs/dir.rs

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ impl Dir {
4242
.map(|result| result.map(|entry| entry.path()))
4343
.collect::<Result<_, _>>()?;
4444

45+
info!("Read directory success {:?}", &path);
4546
Ok(Self { contents, path })
4647
}
4748

src/fs/feature/git.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ fn reorient(path: &Path) -> PathBuf {
332332

333333
#[cfg(windows)]
334334
fn reorient(path: &Path) -> PathBuf {
335-
let unc_path = path.canonicalize().unwrap();
335+
let unc_path = path.canonicalize().unwrap_or_else(|_| path.to_path_buf());
336336
// On Windows UNC path is returned. We need to strip the prefix for it to work.
337337
let normal_path = unc_path.as_os_str().to_str().unwrap().trim_start_matches("\\\\?\\");
338338
PathBuf::from(normal_path)

src/fs/file.rs

+13-7
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ pub struct File<'dir> {
8383
pub extended_attributes: Vec<Attribute>,
8484

8585
/// The absolute value of this path, used to look up mount points.
86-
pub absolute_path: PathBuf,}
86+
pub absolute_path: Option<PathBuf>,
87+
}
8788

8889
impl<'dir> File<'dir> {
8990
pub fn from_args<PD, FN>(path: PathBuf, parent_dir: PD, filename: FN, deref_links: bool) -> io::Result<File<'dir>>
@@ -98,7 +99,7 @@ impl<'dir> File<'dir> {
9899
let metadata = std::fs::symlink_metadata(&path)?;
99100
let is_all_all = false;
100101
let extended_attributes = File::gather_extended_attributes(&path);
101-
let absolute_path = std::fs::canonicalize(&path)?;
102+
let absolute_path = std::fs::canonicalize(&path).ok();
102103

103104
Ok(File { name, ext, path, metadata, parent_dir, is_all_all, deref_links, extended_attributes, absolute_path })
104105
}
@@ -112,7 +113,7 @@ impl<'dir> File<'dir> {
112113
let is_all_all = true;
113114
let parent_dir = Some(parent_dir);
114115
let extended_attributes = File::gather_extended_attributes(&path);
115-
let absolute_path = std::fs::canonicalize(&path)?;
116+
let absolute_path = std::fs::canonicalize(&path).ok();
116117

117118
Ok(File { path, parent_dir, metadata, ext, name: ".".into(), is_all_all, deref_links: false, extended_attributes, absolute_path })
118119
}
@@ -125,7 +126,7 @@ impl<'dir> File<'dir> {
125126
let is_all_all = true;
126127
let parent_dir = Some(parent_dir);
127128
let extended_attributes = File::gather_extended_attributes(&path);
128-
let absolute_path = std::fs::canonicalize(&path)?;
129+
let absolute_path = std::fs::canonicalize(&path).ok();
129130

130131
Ok(File { path, parent_dir, metadata, ext, name: "..".into(), is_all_all, deref_links: false, extended_attributes, absolute_path })
131132
}
@@ -203,6 +204,7 @@ impl<'dir> File<'dir> {
203204
/// Returns an IO error upon failure, but this shouldn’t be used to check
204205
/// if a `File` is a directory or not! For that, just use `is_directory()`.
205206
pub fn to_dir(&self) -> io::Result<Dir> {
207+
trace!("to_dir: reading dir");
206208
Dir::read_dir(self.path.clone())
207209
}
208210

@@ -253,15 +255,18 @@ impl<'dir> File<'dir> {
253255
/// Whether this file is a mount point
254256
pub fn is_mount_point(&self) -> bool {
255257
if cfg!(target_os = "linux") && self.is_directory() {
256-
return ALL_MOUNTS.contains_key(&self.absolute_path);
258+
return match self.absolute_path.as_ref() {
259+
Some(path) => ALL_MOUNTS.contains_key(path),
260+
None => false,
261+
}
257262
}
258263
false
259264
}
260265

261266
/// The filesystem device and type for a mount point
262267
pub fn mount_point_info(&self) -> Option<&MountedFs> {
263268
if cfg!(target_os = "linux") {
264-
return ALL_MOUNTS.get(&self.absolute_path);
269+
return self.absolute_path.as_ref().and_then(|p|ALL_MOUNTS.get(p));
265270
}
266271
None
267272
}
@@ -324,7 +329,7 @@ impl<'dir> File<'dir> {
324329
is_all_all: false,
325330
deref_links: self.deref_links,
326331
extended_attributes,
327-
absolute_path
332+
absolute_path: Some(absolute_path)
328333
};
329334
FileTarget::Ok(Box::new(file))
330335
}
@@ -527,6 +532,7 @@ impl<'dir> File<'dir> {
527532
/// but as mentioned in the size function comment above, different filesystems
528533
/// make it difficult to get any info about a dir by it's size, so this may be it.
529534
fn is_empty_directory(&self) -> bool {
535+
trace!("is_empty_directory: reading dir");
530536
match Dir::read_dir(self.path.clone()) {
531537
// . & .. are skipped, if the returned iterator has .next(), it's not empty
532538
Ok(has_files) => has_files.files(super::DotFilter::Dotfiles, None, false, false).next().is_none(),

0 commit comments

Comments
 (0)