Skip to main content

supersed

supersed is a natural language-powered file editor that leverages LLMs to perform various file manipulations on txt or txt-like files based on user instructions. Simplify your workflow by managing and editing your text files using plain English commands. No more googling for the right commands!

Features

  • Natural Language Editing: Modify text files using simple English commands.
  • Backup and Restore: Automatically backup files before making changes and restore them if needed.
  • Flexible File Targeting: Specify individual files or use patterns to target multiple files, including those in subdirectories.
  • Cross-Platform Compatibility: Works seamlessly on both Linux and macOS systems.

Installation

  1. Use PyPI package: If you simply want to use supersed, install it from PyPI using.

    pip install supersed
    
  2. Clone the Repository: If you would like to contribute to supersed, consider cloning the github directory.

    git clone https://github.com/akcanuv/supersed.git
    cd supersed
    pip install -e .
    
  3. Set Up OpenAI API Key: Obtain your OpenAI API Key from OpenAI and set it as an environment variable:

  • Linux/macOS: export OPENAI_API_KEY='your-api-key-here'
  • Windows (Command Prompt): set OPENAI_API_KEY=your-api-key-here
  • Windows (PowerShell): $env:OPENAI_API_KEY="your-api-key-here" Note that running the above command sets the API key as environment variables only temporarily. To set it permanently, add the statement to .bashrc, .zshrc or any other shell config file for the shell you're using.

Usage

Run the script with your desired command:

supersed "your instruction here"

Commands

  • Execute a Command: Provide an instruction and specify the scope of the commands with -s, default scope is .:
supersed "your instruction" -s "scope"
  • Save Backup: Backup specified files:
supersed save
  • Restore Backup: Restore all backed-up files:
supersed restore

Examples

  1. Update the README.md by Reviewing supersed.py:
supersed "update the README.md file by reviewing the code in supersed.py"
  1. Remove All Blank Spaces in Text Files Within test_files Directory:
supersed "remove all the blank spaces in the text files in test_files directory"
  1. Save Current File Versions to Backup:
supersed save
  1. Restore Files from Backup:
supersed restore

Backup and Restore

  • Backup: Before executing any changes, supersed automatically backs up the target files to a .backup directory. To manually update the backup, use the save command.
  • Restore: If you need to revert changes, use the restore command to retrieve the original files from the .backup directory.

Notes

  • File Patterns: Use glob patterns to specify target files. For recursive searches, use patterns like **/*.txt.
  • Safety: Always ensure you have backups of important files. Use the save command to create a new backup point after satisfactory changes.

License

This project is licensed under the MIT License.

Metadata

Release files for supersed 0.3.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for supersed 0.3.8
File Size Uploaded
supersed-0.3.8.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for supersed 0.3.8
File Interpreter ABI Platform
supersed-0.3.8-py3-none-any.whl Python 3 none any Details

Total release size: 21.1 kB

Release files / supersed-0.3.8.tar.gz

Download URL supersed-0.3.8.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3ed8507e712ce0297783bd2bd738c206458c5d61e882a86721b74460979068b3
BLAKE2b-256 checksum
How to use checksums
87f200c5a2dc9b09759a1ba01163a62e9ee59d0b812a3cdbca3902a761b0ca8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release files / supersed-0.3.8-py3-none-any.whl

Download URL supersed-0.3.8-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36dd1ecff06907348bce241b4402ffbd19591f40d8d90e199ed907e87fa1ccdd
BLAKE2b-256 checksum
How to use checksums
d3e91ee9ef63bbb4f990b8fc2c68c8715b4cb385137d6dd679f5afc1757df157
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release history Release notifications | RSS feed

This release

0.3.8 This release

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page