[PR #13385] Sort options for list / ls models command #45436

Open
opened 2026-04-25 01:08:22 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13385
Author: @karmakaze
Created: 12/8/2025
Status: 🔄 Open

Base: mainHead: ls-sorting


📝 Commits (1)

  • 2d83bb6 Add sort flags to list/ls: -t (time), -U (unsorted so by name), -S (size), -i (ID), -r (reversed)

📊 Changes

2 files changed (+200 additions, -11 deletions)

View changed files

📝 cmd/cmd.go (+75 -1)
📝 cmd/cmd_test.go (+125 -10)

📄 Description

Close https://github.com/ollama/ollama/issues/12866 and #1876

I'd like this to work similarly to ls.

% ollama ls --help
List models

Usage:
  ollama list [flags]

Aliases:
  list, ls

Flags:
  -g, --grouped   Group models.
  -h, --help      help for list
  -i, --id        Sort by ID in alphabetical order.
  -U, --name      Sort by name in alphabetical order.
  -r, --reverse   Reverse the sort order.
  -S, --size      Sort by file size, smallest first.
  -t, --time      Sort by date/time, chronologically (default reversed).

The default sort order is still the same: reverse chronological. When -t is used becomes chronological. Default is -tr.
Other sort flags should be straight-forward.

The -g group option keeps the model listing together by the model name before : character (treating whole name as a group by itself otherwise). The groups are sorted by the sort order, and the items within each group are also sorted.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/13385 **Author:** [@karmakaze](https://github.com/karmakaze) **Created:** 12/8/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `ls-sorting` --- ### 📝 Commits (1) - [`2d83bb6`](https://github.com/ollama/ollama/commit/2d83bb607ac78ba78450b69e0d0eebd1f3286994) Add sort flags to list/ls: -t (time), -U (unsorted so by name), -S (size), -i (ID), -r (reversed) ### 📊 Changes **2 files changed** (+200 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+75 -1) 📝 `cmd/cmd_test.go` (+125 -10) </details> ### 📄 Description Close https://github.com/ollama/ollama/issues/12866 and #1876 I'd like this to work similarly to `ls`. ``` % ollama ls --help List models Usage: ollama list [flags] Aliases: list, ls Flags: -g, --grouped Group models. -h, --help help for list -i, --id Sort by ID in alphabetical order. -U, --name Sort by name in alphabetical order. -r, --reverse Reverse the sort order. -S, --size Sort by file size, smallest first. -t, --time Sort by date/time, chronologically (default reversed). ``` The default sort order is still the same: reverse chronological. When `-t` is used becomes chronological. Default is `-tr`. Other sort flags should be straight-forward. The `-g` group option keeps the model listing together by the model name before `:` character (treating whole name as a group by itself otherwise). The groups are sorted by the sort order, and the items within each group are also sorted. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 01:08:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#45436