Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI command changed from code to codergpt #8

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pip install codergpt
Run the CLI using the following syntax:

```shell
code [OPTIONS] COMMAND [ARGS]...
codergpt [OPTIONS] COMMAND [ARGS]...
```

### Options
Expand All @@ -44,12 +44,12 @@ code [OPTIONS] COMMAND [ARGS]...


```shell
code inspect <path>
codergpt inspect <path>
```

#### Example
```shell
$ code inspect code inspect src/codergpt/
$ codergpt inspect src/codergpt/
Inspecting the code.
File Language
------------------------------------------ ----------
Expand All @@ -72,12 +72,12 @@ code [OPTIONS] COMMAND [ARGS]...
2. `explain`: Explain a specific function or class within a package.

```shell
code explain <path> [--function <function_name>] [--classname <class_name>]
codergpt explain <path> [--function <function_name>] [--classname <class_name>]
```

#### Example
```shell
$ code explain src/codergpt/explainer/explainer.py --function explain
$ codergpt explain src/codergpt/explainer/explainer.py --function explain
Explanation for the code:
This code defines a method called `explain` that takes in three parameters: `code`, `function`, and `classname`. The `code` parameter is a string that represents the code file to be explained. The `function` parameter is an optional string that represents the name of a specific function within the code file that needs to be explained. The `classname` parameter is also an optional string that represents the name of a specific class within the code file that needs to be explained.

Expand All @@ -91,7 +91,7 @@ code [OPTIONS] COMMAND [ARGS]...
3. `comment`: Add comments to the code in a package. The user has the choice to overwrite the file or create a new one.

```shell
code comment <path> [--overwrite/--no-overwrite]
codergpt comment <path> [--overwrite/--no-overwrite]
```
#### Example
- Let's consider a python file `greetings.py`:
Expand All @@ -105,7 +105,7 @@ code [OPTIONS] COMMAND [ARGS]...
```

```shell
$ code comment greetings.py --overwrite
$ codergpt comment greetings.py --overwrite
```
results in ....
```python
Expand All @@ -126,7 +126,7 @@ code [OPTIONS] COMMAND [ARGS]...
4. `optimize`: Optimizes and adds commets to the code in a package. The user has the choice to overwrite the file or create a new one.

```shell
code optimize <path> [--overwrite/--no-overwrite]
codergpt optimize <path> [--overwrite/--no-overwrite]
```
#### Example
- Let's consider a python file `example.py`:
Expand All @@ -147,7 +147,7 @@ code [OPTIONS] COMMAND [ARGS]...
return answer
```
```shell
$ code optimize example.py --overwrite
$ codergpt optimize example.py --overwrite
```
results in ....
```python
Expand Down Expand Up @@ -205,7 +205,7 @@ code [OPTIONS] COMMAND [ARGS]...
5. `write-tests`: Writes tests for the specified code file. The user can specify a function and/or a class within the file to target with the tests.

```shell
code write-tests <path> [--function <function_name>] [--class <classname>]
codergpt write-tests <path> [--function <function_name>] [--class <classname>]
```

#### Example
Expand All @@ -221,7 +221,7 @@ code [OPTIONS] COMMAND [ARGS]...
return a - b
```
```shell
$ code write-tests example.py --function add --class Calculator
$ codergpt write-tests example.py --function add --class Calculator
```
results in test files being generated that contain test cases for the `add` function and the `Calculator` class. The actual content of the test files will depend on the implementation of the `coder.test_writer` method but would typically look something like this:

Expand All @@ -248,7 +248,7 @@ code [OPTIONS] COMMAND [ARGS]...
6. `document`: Generates documentation for the specified code file.

```shell
code document <path>
codergpt document <path>
```

#### Example
Expand All @@ -268,7 +268,7 @@ code [OPTIONS] COMMAND [ARGS]...
return a - b
```
```shell
$ code document example.py
$ codergpt document example.py
```
results in documentation files being generated that contain documentation for all functions and classes within the `example.py` file. The actual content of the documentation files will depend on the implementation of the `DocumentationGenerator.document` method but would typically look something like this:

Expand Down
14 changes: 7 additions & 7 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To use this CLI, run the following command in your terminal:

.. code-block:: shell

python codergpt_cli.py [OPTIONS] COMMAND [ARGS]...
codergpt [OPTIONS] COMMAND [ARGS]...

Options
-------
Expand Down Expand Up @@ -56,37 +56,37 @@ Inspect a package:

.. code-block:: shell

python codergpt_cli.py inspect /path/to/package
codergpt inspect /path/to/package

Explain a function in a file:

.. code-block:: shell

python codergpt_cli.py explain -f my_function /path/to/file.py
codergpt explain -f my_function /path/to/file.py

Add comments to a file with overwrite enabled:

.. code-block:: shell

python codergpt_cli.py comment --overwrite /path/to/file.py
codergpt comment --overwrite /path/to/file.py

Optimize a class within a file without overwriting:

.. code-block:: shell

python codergpt_cli.py optimize -c MyClass /path/to/file.py
codergpt optimize -c MyClass /path/to/file.py

Write tests for a function:

.. code-block:: shell

python codergpt_cli.py write-tests -f my_function /path/to/file.py
codergpt write-tests -f my_function /path/to/file.py

Write documentation for a file:

.. code-block:: shell

python codergpt_cli.py document /path/to/file.py
codergpt document /path/to/file.py

Parameters and Options
----------------------
Expand Down
22 changes: 11 additions & 11 deletions docs/description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Run the CLI using the following syntax:

.. code-block:: shell

code [OPTIONS] COMMAND [ARGS]...
codergpt [OPTIONS] COMMAND [ARGS]...

Options
~~~~~~~
Expand All @@ -67,13 +67,13 @@ Commands

.. code-block:: shell

code inspect <path>
codergpt inspect <path>

**Example**

.. code-block:: shell

$ code inspect src/codergpt/
$ codergpt inspect src/codergpt/
Inspecting the code.
File Language
------------------------------------------ ----------
Expand All @@ -86,21 +86,21 @@ Commands

.. code-block:: shell

code explain <path> [--function <function_name>] [--classname <class_name>]
codergpt explain <path> [--function <function_name>] [--classname <class_name>]

**Example**

.. code-block:: shell

$ code explain src/codergpt/explainer/explainer.py --function explain
$ codergpt 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]
codergpt comment <path> [--overwrite/--no-overwrite]

**Example**

Expand All @@ -117,7 +117,7 @@ Commands

.. code-block:: shell

$ code comment greetings.py --overwrite
$ codergpt comment greetings.py --overwrite

results in ....

Expand All @@ -133,7 +133,7 @@ Commands

.. code-block:: shell

code optimize <path> [--overwrite/--no-overwrite]
codergpt optimize <path> [--overwrite/--no-overwrite]

**Example**

Expand All @@ -158,7 +158,7 @@ Commands

.. code-block:: shell

$ code optimize example.py --overwrite
$ codergpt optimize example.py --overwrite

results in ....

Expand Down Expand Up @@ -217,7 +217,7 @@ Commands

.. code-block:: shell

code write-tests <path> [--function <function_name>] [--class <classname>]
codergpt write-tests <path> [--function <function_name>] [--class <classname>]

**Example**

Expand All @@ -236,7 +236,7 @@ Commands

.. code-block:: shell

$ code write-tests example.py --function add --class Calculator
$ codergpt write-tests example.py --function add --class Calculator

results in the creation of test files that contain test cases for both the `add` function and the `Calculator` class. The content of the generated test files might look like this:

Expand Down
Loading
Loading