# `Minga.Dired`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga/dired.ex#L34)

Pure data structure and functions for Oil.nvim-style directory buffers.

A Dired listing is an editable buffer where each line is a filename.
Saving the buffer diffs current content against the original entry list
and applies the resulting file operations (renames, deletes, creates).

Layer 0: pure functions, no process dependencies.

# `entry`

```elixir
@type entry() :: Minga.Dired.Entry.t()
```

# `operation`

```elixir
@type operation() ::
  {:rename, String.t(), String.t()}
  | {:delete, String.t()}
  | {:create, String.t()}
  | {:mkdir, String.t()}
```

# `sort_key`

```elixir
@type sort_key() :: :name | :size | :date | :extension
```

# `t`

```elixir
@type t() :: %Minga.Dired{
  directory: String.t(),
  entries: [entry()],
  show_details: boolean(),
  show_hidden: boolean(),
  sort_by: sort_key()
}
```

# `diff_operations`

```elixir
@spec diff_operations([entry()], [String.t()], String.t()) :: [operation()]
```

# `entry_at_line`

```elixir
@spec entry_at_line(t(), non_neg_integer()) :: entry() | nil
```

# `format_entry`

```elixir
@spec format_entry(entry(), boolean()) :: String.t()
```

# `format_listing`

```elixir
@spec format_listing(t()) :: String.t()
```

# `next_sort_key`

```elixir
@spec next_sort_key(sort_key()) :: sort_key()
```

# `parent_directory`

```elixir
@spec parent_directory(String.t()) :: String.t()
```

# `parse_listing`

```elixir
@spec parse_listing(String.t()) :: [String.t()]
```

# `read_directory`

```elixir
@spec read_directory(
  String.t(),
  keyword()
) :: {:ok, t()} | {:error, term()}
```

# `refresh`

```elixir
@spec refresh(t()) :: {:ok, t()} | {:error, term()}
```

# `with_show_details`

```elixir
@spec with_show_details(t(), boolean()) :: {:ok, t()} | {:error, term()}
```

# `with_show_hidden`

```elixir
@spec with_show_hidden(t(), boolean()) :: {:ok, t()} | {:error, term()}
```

# `with_sort_by`

```elixir
@spec with_sort_by(t(), sort_key()) :: {:ok, t()} | {:error, term()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
