[PR #10020] cmd: output JSON and CSV formats in the list and ps command line tool #75413

Open
opened 2026-05-05 07:50:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/10020
Author: @hopefulTex
Created: 3/27/2025
Status: 🔄 Open

Base: mainHead: main


📝 Commits (2)

  • 89aab2c Added CSV and JSON output to list and ps commands
  • 56080ca Merge branch 'ollama:main' into main

📊 Changes

1 file changed (+99 additions, -20 deletions)

View changed files

📝 cmd/cmd.go (+99 -20)

📄 Description

The current output from the list and ps commands is a tab separated table, requiring dedicated parsing functions for any program or script piping in the data.

This change allows for easy parsing of installed and running models by local programs, giving local-first solutions more room to focus on their own logic rather than spending resources teasing out information from the, albeit human readable, table.

This change introduces no dependency changes as the Model structure already has JSON tags and the CSV format can be implemented with simple string builders.
Testing these changes can be done by verifying the data in the default output and the formatted outputs are matching. Since the REST API uses JSON marshalling from the Model structure, any errors should surface in the API test.

Draft documentation:

List models on your computer

ollama list 

Optionally specify a format for the output, currently JSON and CSV are supported

ollama list -f json

List which models are currently loaded

ollama ps

Optionally specify a format for the output, currently JSON and CSV are supported

ollama list -f csv

🔄 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/10020 **Author:** [@hopefulTex](https://github.com/hopefulTex) **Created:** 3/27/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`89aab2c`](https://github.com/ollama/ollama/commit/89aab2c87b9da1e42a8b6e58f4d53ce7752c38ba) Added CSV and JSON output to list and ps commands - [`56080ca`](https://github.com/ollama/ollama/commit/56080ca8a62f210738dbb123ec2e60af79f27242) Merge branch 'ollama:main' into main ### 📊 Changes **1 file changed** (+99 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+99 -20) </details> ### 📄 Description The current output from the `list` and `ps` commands is a tab separated table, requiring dedicated parsing functions for any program or script piping in the data. This change allows for easy parsing of installed and running models by local programs, giving local-first solutions more room to focus on their own logic rather than spending resources teasing out information from the, albeit human readable, table. This change introduces no dependency changes as the `Model` structure already has JSON tags and the CSV format can be implemented with simple string builders. Testing these changes can be done by verifying the data in the default output and the formatted outputs are matching. Since the REST API uses JSON marshalling from the `Model` structure, any errors should surface in the API test. Draft documentation: ### List models on your computer ```shell ollama list ``` Optionally specify a format for the output, currently `JSON` and `CSV` are supported ```shell ollama list -f json ``` ### List which models are currently loaded ```shell ollama ps ``` Optionally specify a format for the output, currently `JSON` and `CSV` are supported ```shell ollama list -f csv ``` --- <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-05-05 07:50:31 -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#75413