Skip to content

Commit

Permalink
addded example for comment
Browse files Browse the repository at this point in the history
  • Loading branch information
hrshdhgd committed Feb 10, 2024
1 parent cde2843 commit 409a6aa
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,36 @@ code [OPTIONS] COMMAND [ARGS]...
```shell
code comment <path> [--overwrite/--no-overwrite]
```
#### Example
- Let's consider a python file `greetings.py`:
```
def greet(name):
return f"Hello, {name}!"
if __name__ == "__main__":
user_name = "Alice"
print(greet(user_name))
```
```shell
$ code comment greetings.py --overwrite
```
results in ....
```
def greet(name):
"""
Generates a greeting message for the given name.
:param name: (str) The name of the person to greet.
:return: (str) The greeting message.
"""
return f"Hello, {name}!"
if __name__ == "__main__":
user_name = "Alice"
print(greet(user_name))
```
## Development
The CLI is built using Python and the `click` library. Below is an example of how to define a new command:
Expand Down
13 changes: 13 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def greet(name):
"""
Generates a greeting message for the given name.
:param name: (str) The name of the person to greet.
:return: (str) The greeting message.
"""
return f"Hello, {name}!"


if __name__ == "__main__":
user_name = "Alice"
print(greet(user_name))

0 comments on commit 409a6aa

Please sign in to comment.