diff --git a/README.md b/README.md index 7e1b9dc..428077e 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,36 @@ code [OPTIONS] COMMAND [ARGS]... ```shell code comment [--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: diff --git a/test.py b/test.py new file mode 100644 index 0000000..74f38a0 --- /dev/null +++ b/test.py @@ -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)) \ No newline at end of file