Multiline docstring in help with parameters and their descriptions
- Ngôn ngữ chính
- Python
- Star
- 28.2k
- Fork
- 1.5k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
I'm using the [latest version](https://github.com/google/python-fire/commit/024fbad9424cfdb0d3c93c86c856aedbac0f9d48) of Fire as of now and was wondering if it's possible to display a multiline docstring in help instead of concatenating it to one line. Also is there a way of displaying the available params and their descriptions in the help screen?
Example program:
```python
# main.py
import fire
class MyCLI:
def create(name, surname):
"""
Method to create a user \n
And some second line to describe some specific cases.
And some third line that could be concatenated with the second one
:param name name of the user
:param surname surname of the user
:raises ValueError if user with this name and surname already exist
:returns: unique id of the created user
"""
...
def remove(id):
"""
Removes user given the id
:id unique id to identify the user
:raises ValueError if there is no user with the specified id
"""
...
if __name__ == '__main__':
cli = MyCLI()
fire.Fire(cli)
```
Expected help:
```bash
main.py -h
NAME
main.py -
SYNOPSIS
main.py COMMAND
COMMANDS
COMMAND is one of the following:
create
Method to create a user
And some second line to describe some specific cases. And some third line that could be concatenated with the second one
remove
Removes user given the id
```
Example command help (more specific)
```bash
main.py create -h
NAME
main.py create - Method to create a user
SYNOPSIS
main.py create NAME SURNAME
DESCRIPTION
Method to create a user
And some second line to describe some specific cases. And some third line that could be concatenated with the second one
--name: name of the user
--surname: surname of the user
raises ValueError if user with this name and surname already exist
returns: unique id of the created user
POSITIONAL ARGUMENTS
NAME
SURNAME
NOTES
You can also use flags syntax for POSITIONAL ARGUMENTS
```
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.