google / google/python-fire

Docs don't mention when a class method is considered private v.s public / --help behavior is confusing

Đang mở
#531 2 bình luận 1 reaction 0 người được giao Xem trên GitHub
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ả

Here's a MWE:

```python
#!/usr/bin/env python

from fire import Fire

class Example:
def version(self):
return "bla"
def start(self):
print("starting")
def stop(self):
print("stopping")

Fire(Example)
```

Running this script without arguments shows the available commands - OK:

```
NAME
fire-bug.py

SYNOPSIS
fire-bug.py COMMAND

COMMANDS
COMMAND is one of the following:

start

stop

version
```

But the more common (and usually safe) thing to do when a user is being introduced a new command, is to run it with a `--help`. However, `Fire` doesn't behave the same for this argument:

```
INFO: Showing help with the command 'fire-bug.py -- --help'.

NAME
fire-bug.py

SYNOPSIS
fire-bug.py -
```

Unless you use `--verbose` as well. Why is that? This is not trivial for a user to guess, and only reading the docs here led me to this conclusion. Plus, the docs don't mention how to make a class method a "public" method...

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.