Skip to content

Commit

Permalink
consolidated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hrshdhgd committed Feb 11, 2024
1 parent 22480b9 commit 2b96d37
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 166 deletions.
142 changes: 0 additions & 142 deletions docs/cli.rst

This file was deleted.

166 changes: 166 additions & 0 deletions docs/description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,169 @@ What is it?
CoderGPT is a command line interface for generating/modifying code. It allows developers to
enhance code by commenting, optimizing and adding tests to their projects using the power of LLM.
TThis project is powered by `langchain <https://github.com/langchain-ai/langchain>`_.

Installation
------------

To use the CoderGPT CLI, clone the repository and install the required dependencies.

.. code-block:: shell
pip install codergpt
The most recent code and data can be installed directly from GitHub with:

.. code-block:: shell
pip install git+https://github.com/hrshdhgd/CoderGPT.git
To install in development mode (using `poetry`), use the following:

.. code-block:: shell
$ git clone git+https://github.com/hrshdhgd/CoderGPT.git
$ cd CoderGPT
$ poetry install
Command Line Interface (CLI)
----------------------------

Run the CLI using the following syntax:

.. code-block:: shell
code [OPTIONS] COMMAND [ARGS]...
Options
~~~~~~~

- ``-v, --verbose INTEGER``: Set verbosity level (0, 1, or 2).
- ``-q, --quiet``: Enable quiet mode.
- ``--version``: Display version information.

Commands
~~~~~~~~

1. **inspect**: Inspect a package and display a file-language map.

.. code-block:: shell
code inspect <path>
**Example**

.. code-block:: shell
$ code inspect src/codergpt/
Inspecting the code.
File Language
------------------------------------------ ----------
src/codergpt/constants.py Python
src/codergpt/__init__.py Python
src/codergpt/cli.py Python
...
2. **explain**: Explain a specific function or class within a package.

.. code-block:: shell
code explain <path> [--function <function_name>] [--classname <class_name>]
**Example**

.. code-block:: shell
$ code explain src/codergpt/explainer/explainer.py --function explain
Explanation for the code:
This code defines a method called `explain` that takes in three parameters...
3. **comment**: Add comments to the code in a package. The user has the choice to overwrite the file or create a new one.

.. code-block:: shell
code comment <path> [--overwrite/--no-overwrite]
**Example**

- Let's consider a python file `greetings.py`:

.. code-block:: python
def greet(name):
return f"Hello, {name}!"
if __name__ == "__main__":
user_name = "Alice"
print(greet(user_name))
.. code-block:: shell
$ code comment greetings.py --overwrite
results in ....

.. code-block:: python
def greet(name):
"""
Generates a greeting message for the given name.
...
"""
4. **optimize**: Optimizes and adds comments to the code in a package. The user has the choice to overwrite the file or create a new one.

.. code-block:: shell
code optimize <path> [--overwrite/--no-overwrite]
**Example**

- Let's consider a python file `example.py`:

.. code-block:: python
# example.py
def calculate_sum(numbers):
result = 0
for number in numbers:
result += number
return result
class MathOperations:
def multiply(self, a, b):
answer = 0
for i in range(b):
answer += a
return answer
.. code-block:: shell
$ code optimize example.py --overwrite
results in ....

.. code-block:: python
"""
Optimized and Documented Code:
...
"""
Development
-----------

The CLI is built using Python and the `click` library. Below is an example of how to define a new command:

.. code-block:: python
import click
from codergpt import CoderGPT
coder = CoderGPT()
@click.command()
@click.argument('path', type=click.Path(exists=True))
def new_command(path):
# Command logic here
pass
2 changes: 0 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Welcome to CoderGPT's documentation!
:name: start

description
installation
usage
modules

Indices and tables
Expand Down
22 changes: 0 additions & 22 deletions docs/installation.rst

This file was deleted.

0 comments on commit 2b96d37

Please sign in to comment.