Skip to content

Instantly share code, notes, and snippets.

@moisoto
moisoto / t2c.zsh
Last active December 11, 2024 03:32 — forked from nachoal/t2c.zsh
Text-to-Command (t2c): Convert natural language to shell commands using Ollama LLMs A zsh function that converts natural language queries into shell commands using Ollama's local API. Ask for commands in plain English, review them before execution. Customizable to use any Ollama model. Example: t2c list all python files modified in the last week
#!/bin/zsh
# Function to convert natural language queries into Unix commands using Ollama's API
# Usage: t2c list files in current folder
# Requirements: curl, jq, and Ollama running locally on port 11434
# Remember to run the command: source t2c.zsh
# in order for the command t2c to be available in your current shell session
t2c() {

Markdown for the footnote link1:

Markdown for the footnote link<sup id="a1">[1](#f1)</sup>:

1 This is the footnote markdown:

<b id="f1">1</b> This is the footnote markdown:[](#a1)