Metadata-Version: 2.4
Name: ted-editor
Version: 0.1.2
Summary: Terminal Text Editor with TUI
Home-page: https://github.com/James4Ever0/ted
Author: James Brown
Author-email: randomvoidmail@foxmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: textual>=0.1.18
Provides-Extra: syntax
Requires-Dist: textual[syntax]; extra == "syntax"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary


<div align="center">

<h1>ted</h1>
<p align="center">A simple TUI editor with a CLI and API using Textual</p>
<p align="center">
<a href="https://github.com/james4ever0/ted/blob/master/LICENSE"><img alt="License: WTFPL" src="https://img.shields.io/badge/license-UNLICENSE-green.svg?style=flat"></a>
<a href="https://pypi.org/project/ted-editor/"><img alt="PyPI" src="https://img.shields.io/pypi/v/ted-editor"></a>
<a href="https://deepwiki.com/James4Ever0/ted"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
<a href="https://pepy.tech/projects/ted-editor"><img src="https://static.pepy.tech/badge/ted-editor" alt="PyPI Downloads"></a>
<a href="https://github.com/james4ever0/ted"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
</p>
</div>



## Installation
```bash
# without syntax highlight
pip install ted-editor

# with syntax highlight
pip install ted-editor[syntax]
```

### Key Features

1. **Dual Interface**:
   - CLI: `ted <filepath>`
   - API: `ted.edit(content, filepath)`

2. **File Handling**:
   - Prompt for file path if not provided
   - Ask for file creation if doesn't exist
   - Handle permission errors

3. **TUI Editor**:
   - Textual-based interface
   - Save with Ctrl+S or Save button
   - Quit with Ctrl+Q or Quit button
   - Shows modification status in title
   - Auto-save on quit if modified

4. **API Behavior**:
   - `content=None`: Load from file if exists
   - `filepath=None`: Memory-only editing
   - Returns edited content

### Usage

**CLI:**
```bash
ted  # Prompts for file path
ted myfile.txt
```

**API:**
```python
from ted import edit

# Edit existing file
content = edit(filepath="existing.txt")

# Create new file
new_content = edit(content="New content", filepath="new.txt")

# Memory-only editing
temp_content = edit(content="Temporary text")
```

## See also

[edit](https://github.com/microsoft/edit)

[textual-editor](https://github.com/kyrlian/textual-editor)
