style: switch to nixfmt rfc style, format tree

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
Christina Sørensen 2024-09-26 05:28:35 +02:00
parent 27232c4f9b
commit cb15b12984
11 changed files with 121 additions and 122 deletions

View file

@ -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`

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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 runs-on: ubuntu-22.04
timeout-minutes: 20 timeout-minutes: 20
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Compile - name: Compile
uses: vmactions/freebsd-vm@v1 uses: vmactions/freebsd-vm@v1
with: with:
release: '14.1' release: '14.1'
usesh: true usesh: true
prepare: | prepare: |
pkg install -y rust git pkg install -y rust git
cargo install cargo-hack cargo install cargo-hack
git config --global --add safe.directory /home/runner/work/eza/eza git config --global --add safe.directory /home/runner/work/eza/eza
run: | run: |
set -e set -e
export CARGO_TERM_COLOR="always" export CARGO_TERM_COLOR="always"
export RUSTFLAGS="--deny warnings" export RUSTFLAGS="--deny warnings"
cargo fmt --check cargo fmt --check
cargo clippy -- -D warnings cargo clippy -- -D warnings
cargo hack test 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 runs-on: ubuntu-22.04
timeout-minutes: 20 timeout-minutes: 20
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Compile - name: Compile
uses: vmactions/openbsd-vm@v1 uses: vmactions/openbsd-vm@v1
with: with:
release: '7.4' release: '7.4'
usesh: true usesh: true
prepare: | prepare: |
pkg_add rust rust-rustfmt rust-clippy git pkg_add rust rust-rustfmt rust-clippy git
cargo install cargo-hack cargo install cargo-hack
git config --global --add safe.directory /home/runner/work/eza/eza git config --global --add safe.directory /home/runner/work/eza/eza
run: | run: |
set -e set -e
export CARGO_TERM_COLOR="always" export CARGO_TERM_COLOR="always"
export RUSTFLAGS="--deny warnings" export RUSTFLAGS="--deny warnings"
cargo fmt --check cargo fmt --check
cargo clippy -- -D warnings cargo clippy -- -D warnings
cargo hack test cargo hack test

View file

@ -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

View file

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

View file

@ -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}}}

View file

@ -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 # Meta options
? - null
- --help - --help
: :
? - -v ? - -v
- --version - --version
: :
# Display Options ? - -1 # Display Options
? - -1
- --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 # Filtering and Sorting Options
? - -a
- --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 # Long View Options
? - -b
- --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
:

View file

@ -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"]; shellcheck = {
rustfmt.excludes = ["src/options/flags.rs"]; includes = [
taplo.excludes = ["tests/ptests/*.toml"]; "*.sh"
yamlfmt.excludes = ["./powertest.yaml"]; "./completions/bash/eza"
];
excludes = [ ".envrc" ];
};
rustfmt.excludes = [ "src/options/flags.rs" ];
taplo.excludes = [ "tests/ptests/*.toml" ];
yamlfmt.excludes = [ "./powertest.yaml" ];
}; };
}; };
} }