Prechádzať zdrojové kódy

style: switch to nixfmt rfc style, format tree

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
Christina Sørensen 1 rok pred
rodič
commit
cb15b12984

+ 0 - 1
.github/dependabot.yml

@@ -9,7 +9,6 @@ updates:
     directory: "/" # Location of package manifests
     schedule:
       interval: "weekly"
-
   - package-ecosystem: "github-actions"
     # Workflow files stored in the
     # default location of `.github/workflows`

+ 2 - 4
.github/workflows/apt.yml

@@ -3,20 +3,18 @@ on:
   schedule:
     - cron: '0 0 * * *'
   push:
-    branches: [ main ]
+    branches: [main]
     paths:
       - 'deb.asc'
       - '.github/workflows/apt.yml'
   pull_request:
-    branches: [ main ]
+    branches: [main]
     paths:
       - 'deb.asc'
       - '.github/workflows/apt.yml'
-
 concurrency:
   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
   cancel-in-progress: true
-
 jobs:
   apt_installation:
     runs-on: ubuntu-latest

+ 2 - 5
.github/workflows/conventional-commits.yml

@@ -1,15 +1,12 @@
 name: Conventional Commits
-
 on:
   push:
-    branches: [ main ]
+    branches: [main]
   pull_request:
-    branches: [ main ]
-
+    branches: [main]
 concurrency:
   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
   cancel-in-progress: true
-
 jobs:
   conventional-commits:
     runs-on: ubuntu-latest

+ 1 - 6
.github/workflows/flake.yml

@@ -1,7 +1,7 @@
 on:
   workflow_dispatch:
   pull_request:
-    branches: [ main ]
+    branches: [main]
     paths:
       - '.github/workflows/flake.yml'
       - 'src/**'
@@ -20,11 +20,9 @@ on:
       - "flake.*"
       - "*.nix"
       - "*.rs"
-
 concurrency:
   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
   cancel-in-progress: true
-
 jobs:
   flake-checker:
     name: Flake Checker
@@ -33,7 +31,6 @@ jobs:
       - uses: actions/checkout@v4
       - name: Check Nix flake inputs
         uses: DeterminateSystems/flake-checker-action@v9
-
   check:
     name: Check Nix Flake
     runs-on: ubuntu-22.04
@@ -45,10 +42,8 @@ jobs:
         uses: DeterminateSystems/magic-nix-cache-action@main
       - name: Nix Flake Check
         run: nix flake check --all-systems -L
-
   build:
     name: Build Nix package
-
     # if cross compilation is desired add 'aarch64-linux', 'x86_64-darwin' and 'aarch64-darwin' and fix the flake to support cross compilation.
     strategy:
       matrix:

+ 1 - 4
.github/workflows/no-merge-commits.yml

@@ -1,13 +1,10 @@
 name: No Merge Commits
-
 on:
   pull_request:
-    branches: [ main ]
-
+    branches: [main]
 concurrency:
   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
   cancel-in-progress: true
-
 jobs:
   no-merge-commits:
     runs-on: ubuntu-latest

+ 46 - 51
.github/workflows/unit-tests-bsd.yml

@@ -1,50 +1,46 @@
 name: Unit tests (BSD)
-
 on:
   push:
-    branches: [ main ]
+    branches: [main]
     paths:
       - '.github/workflows/unit-tests-bsd.yml'
       - 'src/**'
       - 'Cargo.*'
       - build.rs
   pull_request:
-    branches: [ main ]
+    branches: [main]
     paths:
       - '.github/workflows/unit-tests-bsd.yml'
       - 'src/**'
       - 'Cargo.*'
       - build.rs
-
 concurrency:
   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
   cancel-in-progress: true
-
 jobs:
   unit-tests-freebsd:
-      runs-on: ubuntu-22.04
-      timeout-minutes: 20
-      steps:
-        - uses: actions/checkout@v4
-          with:
-            submodules: recursive
-        - name: Compile
-          uses: vmactions/freebsd-vm@v1
-          with:
-            release: '14.1'
-            usesh: true
-            prepare: |
-              pkg install -y rust git
-              cargo install cargo-hack
-              git config --global --add safe.directory /home/runner/work/eza/eza
-            run: |
-              set -e
-              export CARGO_TERM_COLOR="always"
-              export RUSTFLAGS="--deny warnings"
-              cargo fmt --check
-              cargo clippy -- -D warnings
-              cargo hack test
-
+    runs-on: ubuntu-22.04
+    timeout-minutes: 20
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          submodules: recursive
+      - name: Compile
+        uses: vmactions/freebsd-vm@v1
+        with:
+          release: '14.1'
+          usesh: true
+          prepare: |
+            pkg install -y rust git
+            cargo install cargo-hack
+            git config --global --add safe.directory /home/runner/work/eza/eza
+          run: |
+            set -e
+            export CARGO_TERM_COLOR="always"
+            export RUSTFLAGS="--deny warnings"
+            cargo fmt --check
+            cargo clippy -- -D warnings
+            cargo hack test
   unit-tests-netbsd:
     runs-on: ubuntu-22.04
     timeout-minutes: 20
@@ -72,27 +68,26 @@ jobs:
             cargo fmt --check
             cargo clippy -- -D warnings
             cargo hack test
-
   unit-tests-openbsd:
-      runs-on: ubuntu-22.04
-      timeout-minutes: 20
-      steps:
-        - uses: actions/checkout@v4
-          with:
-            submodules: recursive
-        - name: Compile
-          uses: vmactions/openbsd-vm@v1
-          with:
-            release: '7.4'
-            usesh: true
-            prepare: |
-              pkg_add rust rust-rustfmt rust-clippy git
-              cargo install cargo-hack
-              git config --global --add safe.directory /home/runner/work/eza/eza
-            run: |
-              set -e
-              export CARGO_TERM_COLOR="always"
-              export RUSTFLAGS="--deny warnings"
-              cargo fmt --check
-              cargo clippy -- -D warnings
-              cargo hack test
+    runs-on: ubuntu-22.04
+    timeout-minutes: 20
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          submodules: recursive
+      - name: Compile
+        uses: vmactions/openbsd-vm@v1
+        with:
+          release: '7.4'
+          usesh: true
+          prepare: |
+            pkg_add rust rust-rustfmt rust-clippy git
+            cargo install cargo-hack
+            git config --global --add safe.directory /home/runner/work/eza/eza
+          run: |
+            set -e
+            export CARGO_TERM_COLOR="always"
+            export RUSTFLAGS="--deny warnings"
+            cargo fmt --check
+            cargo clippy -- -D warnings
+            cargo hack test

+ 4 - 16
.github/workflows/unit-tests.yml

@@ -1,59 +1,47 @@
 name: Unit tests
-
 on:
   push:
-    branches: [ main ]
+    branches: [main]
     paths:
       - '.github/workflows/unit-tests.yml'
       - 'src/**'
       - 'Cargo.*'
       - build.rs
   pull_request:
-    branches: [ main ]
+    branches: [main]
     paths:
       - '.github/workflows/unit-tests.yml'
       - 'src/**'
       - 'Cargo.*'
       - build.rs
-
 concurrency:
   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
   cancel-in-progress: true
-
 env:
   CARGO_TERM_COLOR: always
   RUSTFLAGS: --deny warnings
-
 jobs:
   unit-tests:
     runs-on: ${{ matrix.os }}
-
     continue-on-error: ${{ matrix.rust == 'nightly' }}
-
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
         rust: [1.70.0, stable, beta, nightly]
-
     steps:
       - name: Checkout repository
         uses: actions/checkout@v4
-
       - run: rustup toolchain install ${{ matrix.rust }} --profile minimal
       - uses: Swatinem/rust-cache@v2
-
       - name: Install cargo-hack
         uses: nick-fields/retry@v3
         with:
           timeout_minutes: 5
           max_attempts: 5
           command: cargo install cargo-hack
-
       - name: Run rustfmt checks
         run: cargo fmt --check
-
       - name: Run clippy lints
-        run: cargo clippy -- -D warnings 
-
+        run: cargo clippy -- -D warnings
       - name: Run unit tests
-        run: cargo hack test 
+        run: cargo hack test

+ 13 - 15
.github/workflows/winget.yml

@@ -1,15 +1,13 @@
-name: Publish to Winget
-
-on:
-  release:
-    types: [released]
-
-jobs:
-  publish:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: vedantmgoyal2009/winget-releaser@v2
-        with:
-          identifier: eza-community.eza
-          installers-regex: '-pc-windows-gnu\.zip$'
-          token: ${{ secrets.WINGET_TOKEN }}
+name: Publish to Winget
+on:
+  release:
+    types: [released]
+jobs:
+  publish:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: vedantmgoyal2009/winget-releaser@v2
+        with:
+          identifier: eza-community.eza
+          installers-regex: '-pc-windows-gnu\.zip$'
+          token: ${{ secrets.WINGET_TOKEN }}

+ 0 - 3
docs/theme.yml

@@ -32,16 +32,13 @@ perms:
     foreground: Red
   other_execute:
     foreground: Green
-
 filenames:
   # Just change the icon glyph
   Cargo.toml: {icon: {glyph: 🦀}}
   Cargo.lock: {icon: {glyph: 🦀}}
-
 extensions:
   # Change the filename color and icon
   # NOTE: not all unicode glyphs support color changes
   rs: {filename: {foreground: Red}, icon: {glyph: 🦀}}
-
   # Change the icon glyph and color
   nix: {icon: {glyph: ❄, style: {foreground: White}}}

+ 40 - 12
powertest.yaml

@@ -4,15 +4,13 @@ binary: eza
 gen_binary: target/debug/eza
 args: tests/test_dir
 commands:
-  # Meta options
-  ? - null
+  ? - null # Meta options
     - --help
   :
   ? - -v
     - --version
   :
-  # Display Options
-  ? - -1
+  ? - -1 # Display Options
     - --oneline
   :
   ? - -l
@@ -65,8 +63,10 @@ commands:
       - never
   ? - null
     - --no-quotes
+  :
   ? - null
     - --hyperlink
+  :
   ? - null
     - --absolute
   : values:
@@ -81,14 +81,16 @@ commands:
       - 200
   ? - null
     - --smart-group
-
-  # Filtering and Sorting Options
-  ? - -a
+  :
+  ? - -a # Filtering and Sorting Options
     - --all
+  :
   ? - -A
     - --almost-all
+  :
   ? - -d
     - --list-dirs
+  :
   ? - -L
     - --level
   : prefix: --tree
@@ -100,6 +102,7 @@ commands:
       - 5
   ? - -r
     - --reverse
+  :
   ? - -s
     - --sort
   : short: -s
@@ -129,42 +132,54 @@ commands:
       - type
   ? - null
     - --group-directories-first
+  :
   ? - -D
     - --only-dirs
+  :
   ? - -f
     - --only-files
+  :
   ? - -f
     - --only-files
-  ? # TODO: add more globs
-    - -I
+  :
+  ? - -I # TODO: add more globs
     - --ignore-glob
   : prefix: -l
     values:
       - "*.toml"
   ? - null
     - --git-ignore
-
-  # Long View Options
-  ? - -b
+  :
+  ? - -b # Long View Options
     - --binary
+  :
   ? - -B
     - --bytes
+  :
   ? - -g
     - --group
+  :
   ? - -h
     - --header
+  :
   ? - -H
     - --links
+  :
   ? - -i
     - --inode
+  :
   ? - -m
     - --modified
+  :
   ? - -M
     - --mounts
+  :
   ? - -n
     - --numeric
+  :
   ? - -S
     - --blocksize
+  :
   ? - -t
     - --time
   : prefix: -l
@@ -175,10 +190,13 @@ commands:
       #- created
   ? - -u
     - --accessed
+  :
   ? - -U
     - --created
+  :
   ? - null
     - --changed
+  :
   ? - null
     - --time-style
   : long: time-style
@@ -190,21 +208,31 @@ commands:
       - relative
   ? - null
     - --total-size
+  :
   ? - null
     - --no-permissions
+  :
   ? - -o
     - --octal-permissions
+  :
   ? - null
     - --no-filesize
+  :
   ? - null
     - --no-user
+  :
   ? - null
     - --git
+  :
   ? - null
     - --no-git
+  :
   ? - null
     - --git-repos
+  :
   ? - -@
     - --extended
+  :
   ? - -Z
     - --context
+  :

+ 12 - 5
treefmt.nix

@@ -1,7 +1,7 @@
 {
   projectRootFile = "Cargo.toml";
   programs = {
-    alejandra.enable = true; # nix
+    nixfmt.enable = true; # nix
     statix.enable = true; # nix static analysis
     deadnix.enable = true; # find dead nix code
     rustfmt.enable = true; # rust
@@ -11,10 +11,17 @@
   };
   settings = {
     formatter = {
-      shellcheck.includes = ["*.sh" "./completions/bash/eza"];
-      rustfmt.excludes = ["src/options/flags.rs"];
-      taplo.excludes = ["tests/ptests/*.toml"];
-      yamlfmt.excludes = ["./powertest.yaml"];
+      shellcheck = {
+        includes = [
+          "*.sh"
+          "./completions/bash/eza"
+        ];
+        excludes = [ ".envrc" ];
+      };
+
+      rustfmt.excludes = [ "src/options/flags.rs" ];
+      taplo.excludes = [ "tests/ptests/*.toml" ];
+      yamlfmt.excludes = [ "./powertest.yaml" ];
     };
   };
 }