Просмотр исходного кода

style: switch to nixfmt rfc style, format tree

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
Christina Sørensen 1 год назад
Родитель
Сommit
cb15b12984

+ 0 - 1
.github/dependabot.yml

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

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

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

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

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

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

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

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

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

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

@@ -1,50 +1,46 @@
 name: Unit tests (BSD)
 name: Unit tests (BSD)
-
 on:
 on:
   push:
   push:
-    branches: [ main ]
+    branches: [main]
     paths:
     paths:
       - '.github/workflows/unit-tests-bsd.yml'
       - '.github/workflows/unit-tests-bsd.yml'
       - 'src/**'
       - 'src/**'
       - 'Cargo.*'
       - 'Cargo.*'
       - build.rs
       - build.rs
   pull_request:
   pull_request:
-    branches: [ main ]
+    branches: [main]
     paths:
     paths:
       - '.github/workflows/unit-tests-bsd.yml'
       - '.github/workflows/unit-tests-bsd.yml'
       - 'src/**'
       - 'src/**'
       - 'Cargo.*'
       - 'Cargo.*'
       - build.rs
       - build.rs
-
 concurrency:
 concurrency:
   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
   cancel-in-progress: true
   cancel-in-progress: true
-
 jobs:
 jobs:
   unit-tests-freebsd:
   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:
   unit-tests-netbsd:
     runs-on: ubuntu-22.04
     runs-on: ubuntu-22.04
     timeout-minutes: 20
     timeout-minutes: 20
@@ -72,27 +68,26 @@ jobs:
             cargo fmt --check
             cargo fmt --check
             cargo clippy -- -D warnings
             cargo clippy -- -D warnings
             cargo hack test
             cargo hack test
-
   unit-tests-openbsd:
   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
 name: Unit tests
-
 on:
 on:
   push:
   push:
-    branches: [ main ]
+    branches: [main]
     paths:
     paths:
       - '.github/workflows/unit-tests.yml'
       - '.github/workflows/unit-tests.yml'
       - 'src/**'
       - 'src/**'
       - 'Cargo.*'
       - 'Cargo.*'
       - build.rs
       - build.rs
   pull_request:
   pull_request:
-    branches: [ main ]
+    branches: [main]
     paths:
     paths:
       - '.github/workflows/unit-tests.yml'
       - '.github/workflows/unit-tests.yml'
       - 'src/**'
       - 'src/**'
       - 'Cargo.*'
       - 'Cargo.*'
       - build.rs
       - build.rs
-
 concurrency:
 concurrency:
   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
   cancel-in-progress: true
   cancel-in-progress: true
-
 env:
 env:
   CARGO_TERM_COLOR: always
   CARGO_TERM_COLOR: always
   RUSTFLAGS: --deny warnings
   RUSTFLAGS: --deny warnings
-
 jobs:
 jobs:
   unit-tests:
   unit-tests:
     runs-on: ${{ matrix.os }}
     runs-on: ${{ matrix.os }}
-
     continue-on-error: ${{ matrix.rust == 'nightly' }}
     continue-on-error: ${{ matrix.rust == 'nightly' }}
-
     strategy:
     strategy:
       matrix:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
         os: [ubuntu-latest, macos-latest, windows-latest]
         rust: [1.70.0, stable, beta, nightly]
         rust: [1.70.0, stable, beta, nightly]
-
     steps:
     steps:
       - name: Checkout repository
       - name: Checkout repository
         uses: actions/checkout@v4
         uses: actions/checkout@v4
-
       - run: rustup toolchain install ${{ matrix.rust }} --profile minimal
       - run: rustup toolchain install ${{ matrix.rust }} --profile minimal
       - uses: Swatinem/rust-cache@v2
       - uses: Swatinem/rust-cache@v2
-
       - name: Install cargo-hack
       - name: Install cargo-hack
         uses: nick-fields/retry@v3
         uses: nick-fields/retry@v3
         with:
         with:
           timeout_minutes: 5
           timeout_minutes: 5
           max_attempts: 5
           max_attempts: 5
           command: cargo install cargo-hack
           command: cargo install cargo-hack
-
       - name: Run rustfmt checks
       - name: Run rustfmt checks
         run: cargo fmt --check
         run: cargo fmt --check
-
       - name: Run clippy lints
       - name: Run clippy lints
-        run: cargo clippy -- -D warnings 
-
+        run: cargo clippy -- -D warnings
       - name: Run unit tests
       - 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
     foreground: Red
   other_execute:
   other_execute:
     foreground: Green
     foreground: Green
-
 filenames:
 filenames:
   # Just change the icon glyph
   # Just change the icon glyph
   Cargo.toml: {icon: {glyph: 🦀}}
   Cargo.toml: {icon: {glyph: 🦀}}
   Cargo.lock: {icon: {glyph: 🦀}}
   Cargo.lock: {icon: {glyph: 🦀}}
-
 extensions:
 extensions:
   # Change the filename color and icon
   # Change the filename color and icon
   # NOTE: not all unicode glyphs support color changes
   # NOTE: not all unicode glyphs support color changes
   rs: {filename: {foreground: Red}, icon: {glyph: 🦀}}
   rs: {filename: {foreground: Red}, icon: {glyph: 🦀}}
-
   # Change the icon glyph and color
   # Change the icon glyph and color
   nix: {icon: {glyph: ❄, style: {foreground: White}}}
   nix: {icon: {glyph: ❄, style: {foreground: White}}}

+ 40 - 12
powertest.yaml

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

+ 12 - 5
treefmt.nix

@@ -1,7 +1,7 @@
 {
 {
   projectRootFile = "Cargo.toml";
   projectRootFile = "Cargo.toml";
   programs = {
   programs = {
-    alejandra.enable = true; # nix
+    nixfmt.enable = true; # nix
     statix.enable = true; # nix static analysis
     statix.enable = true; # nix static analysis
     deadnix.enable = true; # find dead nix code
     deadnix.enable = true; # find dead nix code
     rustfmt.enable = true; # rust
     rustfmt.enable = true; # rust
@@ -11,10 +11,17 @@
   };
   };
   settings = {
   settings = {
     formatter = {
     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" ];
     };
     };
   };
   };
 }
 }