# ogham/exa architecture

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

- Interactive diagram: https://gitdiagram.com/ogham/exa
- Repository: https://github.com/ogham/exa

## Overview

exa is a Rust command-line file-listing application. The user supplies paths and options; the program parses configuration, discovers directory entries and metadata, applies filtering and sorting, then formats the results as grid, line, long-details, or tree-style output for the terminal. Long views include metadata such as permissions, timestamps, links, and optional Git status or extended attributes; themes and file-type coloring support presentation. Relationships below follow the README and the available source excerpts and index; some output and option modules were not sampled in full.

Main entry points: [`src/main.rs`](https://github.com/ogham/exa/blob/master/src/main.rs) (Command entry), [`src/output/details.rs`](https://github.com/ogham/exa/blob/master/src/output/details.rs) (Details view), [`src/options/mod.rs`](https://github.com/ogham/exa/blob/master/src/options/mod.rs) (Option configuration), [`src/output/table.rs`](https://github.com/ogham/exa/blob/master/src/output/table.rs) (Metadata table)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and orchestration"]
  node_main["Command entry<br/>[main.rs]"]
  node_options["Option configuration<br/>[mod.rs]"]
  node_parser["Argument parser<br/>[parser.rs]"]
  node_vars["Environment options<br/>[vars.rs]"]
end

subgraph group_filesystem["Filesystem and metadata"]
  node_directory["Directory traversal<br/>[dir.rs]"]
  node_file["File metadata<br/>[file.rs]"]
  node_fields["Metadata fields<br/>[fields.rs]"]
  node_filter["Filtering and sorting<br/>[filter.rs]"]
  node_git["Git status<br/>[git.rs]"]
  node_xattr["Extended attributes<br/>[xattr.rs]"]
  node_filetype["File type detection<br/>[filetype.rs]"]
end

subgraph group_presentation["Output presentation"]
  node_grid["Grid view<br/>[grid.rs]"]
  node_lines["Line view<br/>[lines.rs]"]
  node_details["Details view<br/>[details.rs]"]
  node_grid_details["Grid details view<br/>[grid_details.rs]"]
  node_table["Metadata table<br/>[table.rs]"]
  node_tree["Tree rendering<br/>[tree.rs]"]
  node_filename["File name rendering<br/>[file_name.rs]"]
  node_cell["Text cells<br/>[cell.rs]"]
  node_time["Time formatting<br/>[time.rs]"]
end

subgraph group_styling["Themes and styling"]
  node_theme["Theme and colors<br/>[mod.rs]"]
  node_icons["File icons<br/>[icons.rs]"]
end

node_user(("User"))
node_terminal(("Terminal output"))
node_filesystem_actor[("Filesystem")]

node_user -->|"invokes"| node_main
node_main -->|"parses options"| node_options
node_options -->|"parses arguments"| node_parser
node_options -->|"reads environment"| node_vars
node_main -->|"lists paths"| node_directory
node_directory -->|"reads entries"| node_filesystem_actor
node_directory -->|"constructs entries"| node_file
node_file -->|"provides metadata"| node_fields
node_options -->|"configures filters"| node_filter
node_main -->|"filters entries"| node_filter
node_main -->|"obtains status"| node_git
node_details -->|"reads attributes"| node_xattr
node_filetype -->|"inspects file"| node_file
node_main -->|"renders grid"| node_grid
node_main -->|"renders lines"| node_lines
node_main -->|"renders details"| node_details
node_main -->|"renders grid details"| node_grid_details
node_details -->|"builds rows"| node_table
node_details -->|"uses tree layout"| node_tree
node_grid_details -->|"uses details"| node_details
node_grid_details -->|"uses grid layout"| node_grid
node_table -->|"formats metadata"| node_fields
node_table -->|"gets status"| node_git
node_table -->|"formats timestamps"| node_time
node_details -->|"renders names"| node_filename
node_filename -->|"selects icons"| node_icons
node_filename -->|"builds contents"| node_cell
node_grid -->|"renders names"| node_filename
node_theme -->|"colors file types"| node_filetype
node_main -->|"configures theme"| node_theme
node_main -->|"writes output"| node_terminal

click node_main "https://github.com/ogham/exa/blob/master/src/main.rs"
click node_options "https://github.com/ogham/exa/blob/master/src/options/mod.rs"
click node_parser "https://github.com/ogham/exa/blob/master/src/options/parser.rs"
click node_vars "https://github.com/ogham/exa/blob/master/src/options/vars.rs"
click node_directory "https://github.com/ogham/exa/blob/master/src/fs/dir.rs"
click node_file "https://github.com/ogham/exa/blob/master/src/fs/file.rs"
click node_fields "https://github.com/ogham/exa/blob/master/src/fs/fields.rs"
click node_filter "https://github.com/ogham/exa/blob/master/src/fs/filter.rs"
click node_git "https://github.com/ogham/exa/blob/master/src/fs/feature/git.rs"
click node_xattr "https://github.com/ogham/exa/blob/master/src/fs/feature/xattr.rs"
click node_filetype "https://github.com/ogham/exa/blob/master/src/info/filetype.rs"
click node_grid "https://github.com/ogham/exa/blob/master/src/output/grid.rs"
click node_lines "https://github.com/ogham/exa/blob/master/src/output/lines.rs"
click node_details "https://github.com/ogham/exa/blob/master/src/output/details.rs"
click node_grid_details "https://github.com/ogham/exa/blob/master/src/output/grid_details.rs"
click node_table "https://github.com/ogham/exa/blob/master/src/output/table.rs"
click node_tree "https://github.com/ogham/exa/blob/master/src/output/tree.rs"
click node_filename "https://github.com/ogham/exa/blob/master/src/output/file_name.rs"
click node_cell "https://github.com/ogham/exa/blob/master/src/output/cell.rs"
click node_time "https://github.com/ogham/exa/blob/master/src/output/time.rs"
click node_theme "https://github.com/ogham/exa/blob/master/src/theme/mod.rs"
click node_icons "https://github.com/ogham/exa/blob/master/src/output/icons.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_main,node_options,node_parser,node_vars,node_user toneBlue
class node_directory,node_file,node_fields,node_filter,node_git,node_xattr,node_filetype,node_filesystem_actor toneAmber
class node_grid,node_lines,node_details,node_grid_details,node_table,node_tree,node_filename,node_cell,node_time toneMint
class node_theme,node_icons toneRose
class node_terminal toneIndigo
```

## Components

### CLI and orchestration

- [Command entry](https://github.com/ogham/exa/blob/master/src/main.rs): `src/main.rs`
- [Option configuration](https://github.com/ogham/exa/blob/master/src/options/mod.rs): `src/options/mod.rs`
- [Argument parser](https://github.com/ogham/exa/blob/master/src/options/parser.rs): `src/options/parser.rs`
- [Environment options](https://github.com/ogham/exa/blob/master/src/options/vars.rs): `src/options/vars.rs`

### Filesystem and metadata

- [Directory traversal](https://github.com/ogham/exa/blob/master/src/fs/dir.rs): `src/fs/dir.rs`
- [File metadata](https://github.com/ogham/exa/blob/master/src/fs/file.rs): `src/fs/file.rs`
- [Metadata fields](https://github.com/ogham/exa/blob/master/src/fs/fields.rs): `src/fs/fields.rs`
- [Filtering and sorting](https://github.com/ogham/exa/blob/master/src/fs/filter.rs): `src/fs/filter.rs`
- [Git status](https://github.com/ogham/exa/blob/master/src/fs/feature/git.rs): `src/fs/feature/git.rs`
- [Extended attributes](https://github.com/ogham/exa/blob/master/src/fs/feature/xattr.rs): `src/fs/feature/xattr.rs`
- [File type detection](https://github.com/ogham/exa/blob/master/src/info/filetype.rs): `src/info/filetype.rs`

### Output presentation

- [Grid view](https://github.com/ogham/exa/blob/master/src/output/grid.rs): `src/output/grid.rs`
- [Line view](https://github.com/ogham/exa/blob/master/src/output/lines.rs): `src/output/lines.rs`
- [Details view](https://github.com/ogham/exa/blob/master/src/output/details.rs): `src/output/details.rs`
- [Grid details view](https://github.com/ogham/exa/blob/master/src/output/grid_details.rs): `src/output/grid_details.rs`
- [Metadata table](https://github.com/ogham/exa/blob/master/src/output/table.rs): `src/output/table.rs`
- [Tree rendering](https://github.com/ogham/exa/blob/master/src/output/tree.rs): `src/output/tree.rs`
- [File name rendering](https://github.com/ogham/exa/blob/master/src/output/file_name.rs): `src/output/file_name.rs`
- [Text cells](https://github.com/ogham/exa/blob/master/src/output/cell.rs): `src/output/cell.rs`
- [Time formatting](https://github.com/ogham/exa/blob/master/src/output/time.rs): `src/output/time.rs`

### Themes and styling

- [Theme and colors](https://github.com/ogham/exa/blob/master/src/theme/mod.rs): `src/theme/mod.rs`
- [File icons](https://github.com/ogham/exa/blob/master/src/output/icons.rs): `src/output/icons.rs`

### Other components

- **User**
- **Terminal output**
- **Filesystem**

## Connections

- User → Command entry: invokes (evidence: `README.md`)
- Command entry → Option configuration: parses options (evidence: `src/main.rs`)
- Option configuration → Argument parser: parses arguments (evidence: `src/options/mod.rs`)
- Option configuration → Environment options: reads environment (evidence: `src/options/mod.rs`)
- Command entry → Directory traversal: lists paths (evidence: `src/main.rs`)
- Directory traversal → Filesystem: reads entries (evidence: `src/fs/dir.rs`)
- Directory traversal → File metadata: constructs entries (evidence: `src/fs/dir.rs`)
- File metadata → Metadata fields: provides metadata (evidence: `src/fs/file.rs`)
- Option configuration → Filtering and sorting: configures filters (evidence: `src/options/filter.rs`)
- Command entry → Filtering and sorting: filters entries (evidence: `src/main.rs`)
- Command entry → Git status: obtains status (evidence: `src/main.rs`)
- Details view → Extended attributes: reads attributes (evidence: `src/output/details.rs`)
- File type detection → File metadata: inspects file (evidence: `src/info/filetype.rs`)
- Command entry → Grid view: renders grid (evidence: `src/main.rs`)
- Command entry → Line view: renders lines (evidence: `src/main.rs`)
- Command entry → Details view: renders details (evidence: `src/main.rs`)
- Command entry → Grid details view: renders grid details (evidence: `src/main.rs`)
- Details view → Metadata table: builds rows (evidence: `src/output/details.rs`)
- Details view → Tree rendering: uses tree layout (evidence: `src/output/details.rs`)
- Grid details view → Details view: uses details (evidence: `src/output/grid_details.rs`)
- Grid details view → Grid view: uses grid layout (evidence: `src/output/grid_details.rs`)
- Metadata table → Metadata fields: formats metadata (evidence: `src/output/table.rs`)
- Metadata table → Git status: gets status (evidence: `src/output/table.rs`)
- Metadata table → Time formatting: formats timestamps (evidence: `src/output/table.rs`)
- Details view → File name rendering: renders names (evidence: `src/output/details.rs`)
- File name rendering → File icons: selects icons (evidence: `src/output/file_name.rs`)
- File name rendering → Text cells: builds contents (evidence: `src/output/file_name.rs`)
- Grid view → File name rendering: renders names (evidence: `src/output/grid.rs`)
- Theme and colors → File type detection: colors file types (evidence: `src/theme/mod.rs`)
- Command entry → Theme and colors: configures theme (evidence: `src/main.rs`)
- Command entry → Terminal output: writes output (evidence: `src/main.rs`)
