Metadata-Version: 2.5
Name: cmdo-terminal
Version: 1.0.0
Summary: A mini Google for the terminal - explain commands, find the right one for a task, and check what is installed. Fully offline.
Project-URL: Homepage, https://github.com/LuShadowX/cmdo
Project-URL: Source, https://github.com/LuShadowX/cmdo
Project-URL: Issues, https://github.com/LuShadowX/cmdo/issues
Author: LuShadowX
License: MIT License
        
        Copyright (c) 2026 LuShadowX
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: cli,commands,documentation,offline,reference,shell,terminal
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Documentation
Classifier: Topic :: System :: Shells
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# cmdo

A mini Google for your terminal. Ask what a command does, describe a task and get the
command for it, or check what is installed on your machine — all offline.

No API keys. No network calls. No dependencies beyond the `python3` already on your system.

```
$ cmdo how "join two commands"

  how to: join two commands

  1. |   strong match
     The pipe. Sends the output of one command straight into the input of the next.
     Use it when you want to filter, sort, count or transform whatever another
     command prints.
       cat file.txt | grep error
       ps aux | grep node | wc -l
```

## Install

```bash
pip install cmdo-terminal
```

The package is `cmdo-terminal` because `cmdo` was already taken on PyPI. The command
you type is still `cmdo`.

Or, to keep it isolated from your other Python packages:

```bash
pipx install cmdo-terminal
```

Straight from source, without waiting for a release:

```bash
pip install git+https://github.com/LuShadowX/cmdo.git
```

There is nothing to configure — the command database ships inside the package.
To uninstall: `pip uninstall cmdo-terminal`.

## The three things it does

### 1. Explain a command

```
$ cmdo grep

  grep  · text
  Search text for lines that match a pattern, and print them.

  Give it a pattern and some input - a file, several files, or a pipe - and it
  prints every line that matches. The pattern is a regular expression, so it
  handles far more than plain words. The flags you will use constantly are -i to
  ignore case, -r to search a whole directory recursively, -n to show line
  numbers, and -v to invert the match and show lines that do not contain the
  pattern.

  EXAMPLES
    grep -rn 'TODO' src/
      find every TODO in a directory, with file and line numbers
    cat app.log | grep -i error
      keep only the error lines, ignoring case

  When to reach for it: you know roughly what the text says but not which file
  or line it is on.

  SEE ALSO  rg · sed · awk · find
  ON THIS SYSTEM  /usr/bin/grep
```

Operators count as commands, so `cmdo '|'`, `cmdo '&&'` and `cmdo '2>&1'` all work.
So do multi-word git entries: `cmdo git rebase`.

### 2. Search by what you want to do

```
$ cmdo how "find text in files"
```

Describe the task in plain words. It ranks the database by weighted keyword scoring and
shows the top three, each with why it fits and a concrete example. If nothing scores well
enough it says so rather than guessing.

### 3. Check your machine

```
$ cmdo have docker

  yes  docker is installed
    path     /opt/homebrew/bin/docker
    real     /opt/homebrew/Cellar/docker/28.4.0/bin/docker
    version  Docker version 28.4.0, build d8eb465f86
    what     Build and run applications in containers.
```

Exit code is 0 when found and 1 when not, so it works in scripts:

```bash
cmdo have jq >/dev/null || brew install jq
```

And to see what you already have:

```
$ cmdo search net

  17 installed commands matching net

  netstat                  Show network connections, listening ports and...
  nettop                   Display updated information about the network...
  networksetup             configuration tool for network settings in...
```

## Typos and unknown commands

Misspell something and it suggests the closest real match:

```
$ cmdo gerp

  Unknown command: gerp

  Did you mean grep or zgrep or gperf?
  Run: cmdo grep
```

If a command is installed but not in the database, cmdo reads your own man page for it,
so coverage is not limited to what ships in the JSON.

## What is in the database

177 hand-written entries — not scraped man pages:

| Area | Covers |
| --- | --- |
| Operators | `\|` `&&` `\|\|` `>` `>>` `2>&1` `&` `$( )` `*` `~` `!!` `$?` and more |
| Files | ls, cd, cp, mv, rm, find, chmod, chown, du, df, ln, stat |
| Text | grep, sed, awk, cut, sort, uniq, wc, tr, tee, diff, xargs, jq |
| Networking | curl, wget, ssh, scp, rsync, dig, ping, lsof, netstat, nc, openssl |
| Processes | ps, top, kill, pkill, pgrep, jobs, nohup, watch, timeout |
| Git | 26 entries — status, add, commit, push, pull, rebase, stash, reset, blame |
| System | uname, env, export, alias, sudo, crontab, history, date |
| Archives | tar, zip, unzip, gzip, zcat |
| Packages | brew, apt, npm, npx, pip3 |

## Options

```
cmdo <command>           Explain a command in plain English
cmdo how "<task>"        Find the right command for what you want to do
cmdo have <command>      Check if a command is installed, and where
cmdo search <keyword>    List installed commands matching a keyword

-h, --help       Show help
-v, --version    Show version
    --no-color   Disable colored output
```

Colour turns itself off when output is piped, and honours `NO_COLOR`.

## How it works

One Python module, one JSON file. `cmdo` is stdlib-only — `json`, `difflib`, `shutil`,
`subprocess`, `textwrap`. It has zero package dependencies, so `pip install cmdo-terminal`
downloads nothing but cmdo itself.

`how` scores every entry against your query: an exact keyword phrase is worth 10 points,
a token inside a keyword 4, a token in the summary 3, in the detail 1, and a `difflib`
close match 3 for typos. The total is scaled by how much of your query was matched, so a
short precise hit beats a long noisy one. Anything under a floor score is reported as
"no confident match" instead of a wrong answer.

Adding a command means adding an object to `src/cmdo/data/commands.json` — name,
category, summary, detail, examples, keywords. No code changes.

```
src/cmdo/
├── cli.py               everything: parsing, scoring, rendering, system probing
├── __main__.py          so `python3 -m cmdo` works too
└── data/commands.json   the knowledge base
```

## Requirements

- macOS or Linux
- Python 3.8 or newer (preinstalled on macOS and every mainstream Linux distribution)

## Licence

MIT
