Do not execute anything if command line is invalid, and make it the default behavior
- Linguagem predominante
- Python
- Estrelas
- 28.2k
- Forks
- 1.5k
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
I know a similar issue has been mentioned in #222 (which should have been labelled as Duplicated rather than a misleadingly Closed) , #226, and its root cause was well-explained in #168.
It is still worth to point out that, this issue can be much more easier to hit, thus much more severe than those somewhat contrived scenarios described in #222 and #168 (which was triggered by mismatching default parameters and/or typo).
```python
# This is part of an CRUD app
def add(name):
print("Record %s has been added into database" % name)
if __name__ == "__main__":
fire.Fire()
```
My end user (or me) could easily run it with `$python my_app.py add John Doe` (forgot to add quotation marks) and then a record `"John"` would have been added into database while the end user saw a command-line error. At that point, it is not just about issuing the right command, the end user need to clean up the messed-up database.
Although a decorator workaround was mentioned in #168, do you think it is better to do it the other way around, i.e. make such "strict mode" (#226) the default behavior, and let developer to chain commands if they really want to? I bet not many developer know and anticipate the command chaining behavior.
Guia de contribuição
Direção de pesquisa
The issue names no source file or test; start at the fire.Fire() command-line entry point and reproduce the unquoted-argument example with the provided CRUD function. Done means an invalid command-line invocation performs no application action by default, while the intended command-chaining behavior remains an explicit choice.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- cli
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100