Skip to content

Commit

Permalink
Added more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hrshdhgd committed Feb 10, 2024
1 parent 935621e commit 9a7f725
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ code [OPTIONS] COMMAND [ARGS]...

### Commands

#### inspect

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

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

##### example
#### Example
```shell
$ code inspect code inspect src/codergpt/
Inspecting the code.
Expand All @@ -62,17 +60,26 @@ src/codergpt/test_writer/__init__.py Python
```


#### explain

Explain a specific function or class within a package.
`explain`: Explain a specific function or class within a package.

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

#### comment
#### Example
```shell
$ code explain src/codergpt/explainer/explainer.py -f 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.

The method first checks if the `function` parameter is provided. If it is, the method invokes a `chain` by passing a dictionary with an "input" key and a formatted string containing the code. The response from the `chain.invoke` call is then printed in a pretty format, including the name of the function being explained.

If the `function` parameter is not provided but the `classname` parameter is, the same process is followed, but with the class name instead.

If both `function` and `classname` parameters are not provided, the method assumes that the full code needs to be explained. It again invokes the `chain` with the code as input and prints the response in a pretty format, indicating that it is explaining the entire code.
```
Add comments to the code in a package.
`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]
Expand Down

0 comments on commit 9a7f725

Please sign in to comment.