# lsd-rs/lsd architecture

> Architecture diagram of the GitHub repository lsd-rs/lsd, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lsd-rs/lsd
- Repository: https://github.com/lsd-rs/lsd

## Overview

lsd is a terminal file-listing application: it accepts paths and display options, gathers filesystem metadata (including optional Git status), orders entries, and renders grid, long, or tree output with configurable colors and icons. The graph follows that user-to-output flow and retains the major customization and metadata capabilities. Some orchestration and subsystem calls are supported only by the SOURCE INDEX; those links are marked dashed with no evidence path rather than presented as inspected call sites.

Main entry points: [`src/core.rs`](https://github.com/lsd-rs/lsd/blob/main/src/core.rs) (Listing coordinator), [`src/display.rs`](https://github.com/lsd-rs/lsd/blob/main/src/display.rs) (Layout rendering), [`src/theme.rs`](https://github.com/lsd-rs/lsd/blob/main/src/theme.rs) (Theme loading), [`src/app.rs`](https://github.com/lsd-rs/lsd/blob/main/src/app.rs) (CLI arguments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Invocation and options"]
  node_cli["CLI arguments<br/>[app.rs]"]
  node_config["Configuration files<br/>[config_file.rs]"]
  node_flags["Resolved options<br/>[flags.rs]"]
end

subgraph group_listing["Listing pipeline"]
  node_core["Listing coordinator<br/>[core.rs]"]
  node_sort["Entry sorting<br/>[sort.rs]"]
end

subgraph group_metadata["Entry metadata"]
  node_filesystem["Filesystem metadata<br/>[mod.rs]"]
  node_name["Names and links<br/>[name.rs]"]
  node_git["Git status<br/>[git.rs]"]
  node_gitstatus["Per-entry Git state<br/>[git_file_status.rs]"]
end

subgraph group_presentation["Output and themes"]
  node_display["Layout rendering<br/>[display.rs]"]
  node_color["Color styling<br/>[color.rs]"]
  node_icons["Icon rendering<br/>[icon.rs]"]
  node_themes["Theme loading<br/>[theme.rs]"]
  node_color_theme["Color theme<br/>[color.rs]"]
  node_icon_theme["Icon theme<br/>[icon.rs]"]
  node_git_theme["Git theme symbols<br/>[git_theme.rs]"]
end

node_user(("CLI user"))

node_user -->|"supplies options"| node_cli
node_cli -->|"configures"| node_flags
node_config -->|"provides defaults"| node_flags
node_cli -.->|"starts listing"| node_core
node_flags -.->|"controls listing"| node_core
node_core -.->|"gathers entries"| node_filesystem
node_filesystem -.->|"requests status"| node_git
node_git -->|"produces status"| node_gitstatus
node_core -.->|"orders entries"| node_sort
node_core -.->|"renders listing"| node_display
node_display -->|"renders metadata"| node_filesystem
node_display -->|"renders names"| node_name
node_name -->|"requests icon"| node_icons
node_name -->|"uses styling"| node_color
node_display -->|"styles output"| node_color
node_themes -->|"finds config paths"| node_config
node_themes -->|"loads color theme"| node_color_theme
node_themes -->|"loads icon theme"| node_icon_theme
node_color -->|"uses theme"| node_color_theme
node_icons -->|"uses theme"| node_icon_theme
node_core -.->|"configures Git display"| node_git_theme

click node_cli "https://github.com/lsd-rs/lsd/blob/main/src/app.rs"
click node_config "https://github.com/lsd-rs/lsd/blob/main/src/config_file.rs"
click node_flags "https://github.com/lsd-rs/lsd/blob/main/src/flags.rs"
click node_core "https://github.com/lsd-rs/lsd/blob/main/src/core.rs"
click node_sort "https://github.com/lsd-rs/lsd/blob/main/src/sort.rs"
click node_filesystem "https://github.com/lsd-rs/lsd/blob/main/src/meta/mod.rs"
click node_name "https://github.com/lsd-rs/lsd/blob/main/src/meta/name.rs"
click node_git "https://github.com/lsd-rs/lsd/blob/main/src/git.rs"
click node_gitstatus "https://github.com/lsd-rs/lsd/blob/main/src/meta/git_file_status.rs"
click node_display "https://github.com/lsd-rs/lsd/blob/main/src/display.rs"
click node_color "https://github.com/lsd-rs/lsd/blob/main/src/color.rs"
click node_icons "https://github.com/lsd-rs/lsd/blob/main/src/icon.rs"
click node_themes "https://github.com/lsd-rs/lsd/blob/main/src/theme.rs"
click node_color_theme "https://github.com/lsd-rs/lsd/blob/main/src/theme/color.rs"
click node_icon_theme "https://github.com/lsd-rs/lsd/blob/main/src/theme/icon.rs"
click node_git_theme "https://github.com/lsd-rs/lsd/blob/main/src/git_theme.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_config,node_flags,node_user toneBlue
class node_core,node_sort toneAmber
class node_filesystem,node_name,node_git,node_gitstatus toneMint
class node_display,node_color,node_icons,node_themes,node_color_theme,node_icon_theme,node_git_theme toneRose
```

## Components

### Invocation and options

- [CLI arguments](https://github.com/lsd-rs/lsd/blob/main/src/app.rs): `src/app.rs`
- [Configuration files](https://github.com/lsd-rs/lsd/blob/main/src/config_file.rs): `src/config_file.rs`
- [Resolved options](https://github.com/lsd-rs/lsd/blob/main/src/flags.rs): `src/flags.rs`

### Listing pipeline

- [Listing coordinator](https://github.com/lsd-rs/lsd/blob/main/src/core.rs): `src/core.rs`
- [Entry sorting](https://github.com/lsd-rs/lsd/blob/main/src/sort.rs): `src/sort.rs`

### Entry metadata

- [Filesystem metadata](https://github.com/lsd-rs/lsd/blob/main/src/meta/mod.rs): `src/meta/mod.rs`
- [Names and links](https://github.com/lsd-rs/lsd/blob/main/src/meta/name.rs): `src/meta/name.rs`
- [Git status](https://github.com/lsd-rs/lsd/blob/main/src/git.rs): `src/git.rs`
- [Per-entry Git state](https://github.com/lsd-rs/lsd/blob/main/src/meta/git_file_status.rs): `src/meta/git_file_status.rs`

### Output and themes

- [Layout rendering](https://github.com/lsd-rs/lsd/blob/main/src/display.rs): `src/display.rs`
- [Color styling](https://github.com/lsd-rs/lsd/blob/main/src/color.rs): `src/color.rs`
- [Icon rendering](https://github.com/lsd-rs/lsd/blob/main/src/icon.rs): `src/icon.rs`
- [Theme loading](https://github.com/lsd-rs/lsd/blob/main/src/theme.rs): `src/theme.rs`
- [Color theme](https://github.com/lsd-rs/lsd/blob/main/src/theme/color.rs): `src/theme/color.rs`
- [Icon theme](https://github.com/lsd-rs/lsd/blob/main/src/theme/icon.rs): `src/theme/icon.rs`
- [Git theme symbols](https://github.com/lsd-rs/lsd/blob/main/src/git_theme.rs): `src/git_theme.rs`

### Other components

- **CLI user**

## Connections

- CLI user → CLI arguments: supplies options (evidence: `README.md`)
- CLI arguments → Resolved options: configures (evidence: `src/flags.rs`)
- Configuration files → Resolved options: provides defaults (evidence: `src/flags.rs`)
- CLI arguments → Listing coordinator: starts listing
- Resolved options → Listing coordinator: controls listing (evidence: `src/core.rs`)
- Listing coordinator → Filesystem metadata: gathers entries (evidence: `src/core.rs`)
- Filesystem metadata → Git status: requests status (evidence: `src/meta/mod.rs`)
- Git status → Per-entry Git state: produces status (evidence: `src/git.rs`)
- Listing coordinator → Entry sorting: orders entries (evidence: `src/core.rs`)
- Listing coordinator → Layout rendering: renders listing (evidence: `src/core.rs`)
- Layout rendering → Filesystem metadata: renders metadata (evidence: `src/display.rs`)
- Layout rendering → Names and links: renders names (evidence: `src/display.rs`)
- Names and links → Icon rendering: requests icon (evidence: `src/meta/name.rs`)
- Names and links → Color styling: uses styling (evidence: `src/meta/name.rs`)
- Layout rendering → Color styling: styles output (evidence: `src/display.rs`)
- Theme loading → Configuration files: finds config paths (evidence: `src/theme.rs`)
- Theme loading → Color theme: loads color theme (evidence: `src/theme.rs`)
- Theme loading → Icon theme: loads icon theme (evidence: `src/theme.rs`)
- Color styling → Color theme: uses theme (evidence: `src/color.rs`)
- Icon rendering → Icon theme: uses theme (evidence: `src/icon.rs`)
- Listing coordinator → Git theme symbols: configures Git display (evidence: `src/core.rs`)
