nl2cmd


Namenl2cmd JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummaryNatural language to terminal command translation tool
upload_time2025-08-26 06:33:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords cli natural-language terminal commands translation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nl2cmd

A natural language to terminal command translation tool that helps you convert plain English descriptions into appropriate terminal commands based on your operating system.

## Features

- **Multi-platform support**: Automatically detects and adapts to Linux, macOS, and Windows
- **Natural language processing**: Understands common phrases and descriptions
- **Smart intent detection**: Maps your description to the most appropriate command
- **Command explanations**: Provides detailed breakdowns of generated commands
- **Alternative suggestions**: Offers multiple approaches when available
- **CLI interface**: Easy-to-use command-line tool

## Installation

### From PyPI (when published)

```bash
pip install nl2cmd
```

### From source

```bash
git clone https://github.com/yourusername/nl2cmd.git
cd nl2cmd
pip install -e .
```

## Usage

### Command Line Interface

```bash
# Basic usage
nl2cmd "show current directory"
nl2cmd "list files in this folder"
nl2cmd "create a new directory called test"

# With options
nl2cmd --explain "remove all files in current directory"
nl2cmd --json "show running processes"
nl2cmd --os linux "list network connections"
```

### Python API

```python
from nl2cmd import NL2Cmd

# Initialize translator
translator = NL2Cmd()

# Translate natural language to command
result = translator.translate("show current directory")
print(f"Command: {result.command}")
print(f"Explanation: {result.explanation}")

# Override OS for testing
translator = NL2Cmd(forced_os="windows")
result = translator.translate("list files")
print(f"Windows command: {result.command}")
```

## Supported Commands

The tool recognizes and translates various types of operations:

### File Operations
- List files and directories (`ls`, `dir`)
- Change directories (`cd`)
- Create directories (`mkdir`)
- Remove files (`rm`, `del`)
- Copy files (`cp`, `copy`)
- Move/rename files (`mv`, `move`)

### System Information
- Current working directory (`pwd`, `cd`)
- Process management (`ps`, `tasklist`)
- Network information (`netstat`, `ss`)
- Disk and memory usage (`df`, `du`)

### Package Management
- Install packages (`apt`, `brew`, `winget`)
- Update packages (`apt update`, `brew upgrade`)

### Git Operations
- Status, pull, push, clone
- Branch management
- Commit history

### Docker Operations
- Container management
- Image operations
- Build and run commands

## Examples

| Natural Language | Linux/macOS | Windows | Explanation |
|------------------|-------------|---------|-------------|
| "show current directory" | `pwd` | `cd` | Display current working directory |
| "list files" | `ls` | `dir` | List contents of current directory |
| "create folder test" | `mkdir test` | `mkdir test` | Create a new directory |
| "remove file.txt" | `rm file.txt` | `del file.txt` | Delete a file |
| "copy source to dest" | `cp source dest` | `copy source dest` | Copy files |

## Development

### Setup Development Environment

```bash
git clone https://github.com/yourusername/nl2cmd.git
cd nl2cmd
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e ".[dev]"
```

### Run Tests

```bash
pytest
```

### Code Formatting

```bash
black src/ tests/
flake8 src/ tests/
mypy src/
```

## Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- Inspired by the need to make terminal commands more accessible
- Built with modern Python packaging standards
- Uses semantic matching for natural language understanding

## Roadmap

- [ ] Expand command coverage
- [ ] Add interactive mode
- [ ] Support for command chaining
- [ ] Integration with shell history
- [ ] Machine learning improvements
- [ ] Plugin system for custom commands

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nl2cmd",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Supratim Sircar <ssircar@cisco.com>",
    "keywords": "cli, natural-language, terminal, commands, translation",
    "author": null,
    "author_email": "Supratim Sircar <ssircar@cisco.com>",
    "download_url": "https://files.pythonhosted.org/packages/0d/96/2b822579b4ff5d702ab35cae4d4d14a2656b5f888825049e5b72eee82f42/nl2cmd-1.1.0.tar.gz",
    "platform": null,
    "description": "# nl2cmd\n\nA natural language to terminal command translation tool that helps you convert plain English descriptions into appropriate terminal commands based on your operating system.\n\n## Features\n\n- **Multi-platform support**: Automatically detects and adapts to Linux, macOS, and Windows\n- **Natural language processing**: Understands common phrases and descriptions\n- **Smart intent detection**: Maps your description to the most appropriate command\n- **Command explanations**: Provides detailed breakdowns of generated commands\n- **Alternative suggestions**: Offers multiple approaches when available\n- **CLI interface**: Easy-to-use command-line tool\n\n## Installation\n\n### From PyPI (when published)\n\n```bash\npip install nl2cmd\n```\n\n### From source\n\n```bash\ngit clone https://github.com/yourusername/nl2cmd.git\ncd nl2cmd\npip install -e .\n```\n\n## Usage\n\n### Command Line Interface\n\n```bash\n# Basic usage\nnl2cmd \"show current directory\"\nnl2cmd \"list files in this folder\"\nnl2cmd \"create a new directory called test\"\n\n# With options\nnl2cmd --explain \"remove all files in current directory\"\nnl2cmd --json \"show running processes\"\nnl2cmd --os linux \"list network connections\"\n```\n\n### Python API\n\n```python\nfrom nl2cmd import NL2Cmd\n\n# Initialize translator\ntranslator = NL2Cmd()\n\n# Translate natural language to command\nresult = translator.translate(\"show current directory\")\nprint(f\"Command: {result.command}\")\nprint(f\"Explanation: {result.explanation}\")\n\n# Override OS for testing\ntranslator = NL2Cmd(forced_os=\"windows\")\nresult = translator.translate(\"list files\")\nprint(f\"Windows command: {result.command}\")\n```\n\n## Supported Commands\n\nThe tool recognizes and translates various types of operations:\n\n### File Operations\n- List files and directories (`ls`, `dir`)\n- Change directories (`cd`)\n- Create directories (`mkdir`)\n- Remove files (`rm`, `del`)\n- Copy files (`cp`, `copy`)\n- Move/rename files (`mv`, `move`)\n\n### System Information\n- Current working directory (`pwd`, `cd`)\n- Process management (`ps`, `tasklist`)\n- Network information (`netstat`, `ss`)\n- Disk and memory usage (`df`, `du`)\n\n### Package Management\n- Install packages (`apt`, `brew`, `winget`)\n- Update packages (`apt update`, `brew upgrade`)\n\n### Git Operations\n- Status, pull, push, clone\n- Branch management\n- Commit history\n\n### Docker Operations\n- Container management\n- Image operations\n- Build and run commands\n\n## Examples\n\n| Natural Language | Linux/macOS | Windows | Explanation |\n|------------------|-------------|---------|-------------|\n| \"show current directory\" | `pwd` | `cd` | Display current working directory |\n| \"list files\" | `ls` | `dir` | List contents of current directory |\n| \"create folder test\" | `mkdir test` | `mkdir test` | Create a new directory |\n| \"remove file.txt\" | `rm file.txt` | `del file.txt` | Delete a file |\n| \"copy source to dest\" | `cp source dest` | `copy source dest` | Copy files |\n\n## Development\n\n### Setup Development Environment\n\n```bash\ngit clone https://github.com/yourusername/nl2cmd.git\ncd nl2cmd\npython -m venv .venv\nsource .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\npip install -e \".[dev]\"\n```\n\n### Run Tests\n\n```bash\npytest\n```\n\n### Code Formatting\n\n```bash\nblack src/ tests/\nflake8 src/ tests/\nmypy src/\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Inspired by the need to make terminal commands more accessible\n- Built with modern Python packaging standards\n- Uses semantic matching for natural language understanding\n\n## Roadmap\n\n- [ ] Expand command coverage\n- [ ] Add interactive mode\n- [ ] Support for command chaining\n- [ ] Integration with shell history\n- [ ] Machine learning improvements\n- [ ] Plugin system for custom commands\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Natural language to terminal command translation tool",
    "version": "1.1.0",
    "project_urls": null,
    "split_keywords": [
        "cli",
        " natural-language",
        " terminal",
        " commands",
        " translation"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9c4813191831d5a9caff1570605341760527d550df69ca5278853fb574902ae3",
                "md5": "5178511970c088fd2f0f75ae955b00b9",
                "sha256": "fc7fd8b57f3c9992e400bb7edb93aa1a6063c71ef493987adabf80e1b2cfccbe"
            },
            "downloads": -1,
            "filename": "nl2cmd-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5178511970c088fd2f0f75ae955b00b9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 23009,
            "upload_time": "2025-08-26T06:33:03",
            "upload_time_iso_8601": "2025-08-26T06:33:03.214263Z",
            "url": "https://files.pythonhosted.org/packages/9c/48/13191831d5a9caff1570605341760527d550df69ca5278853fb574902ae3/nl2cmd-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0d962b822579b4ff5d702ab35cae4d4d14a2656b5f888825049e5b72eee82f42",
                "md5": "4b286ff3e5f242a4e7a3b506bc7a395f",
                "sha256": "77b0f70302230ffebac3f1397d56974318d600be71fef65252cfa9e91369d508"
            },
            "downloads": -1,
            "filename": "nl2cmd-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4b286ff3e5f242a4e7a3b506bc7a395f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 22388,
            "upload_time": "2025-08-26T06:33:04",
            "upload_time_iso_8601": "2025-08-26T06:33:04.857458Z",
            "url": "https://files.pythonhosted.org/packages/0d/96/2b822579b4ff5d702ab35cae4d4d14a2656b5f888825049e5b72eee82f42/nl2cmd-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-26 06:33:04",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "nl2cmd"
}
        
Elapsed time: 1.51354s