Comments (3)
Oops, I realize the requirement for rst is not documented anywhere, indeed (I guess this is implied by the statement "Docstrings can use the standard Sphinx-style ... or Google- and Numpy-style docstrings (see examples/styles.py), which are converted using Napoleon [1]." at the top of features.rst).
I added that information explicitly to the docstring of run().
Adding support for markdown likely means plugging something like myst-parser (as I'll likely not want to get away from using docutils as core), which may require some work.
from defopt.
I don't mind adding support for definition_lists (or rather taking a PR that does so), but I suspect what you really want to write here is
import defopt
def main(*, arg: int) -> None:
"""Short tool description
longer description
Args:
arg: description
Output Format 2:
- detail 1
- detail 2
- sub-detail 2.2
- detail 3
"""
pass
if __name__ == '__main__':
defopt.run(main)
which I agree is a lot of whitespace, but that's rst's syntax (AFAICT) and I'm not going to change that here.
Now the above form does run into the error you reported at #123 and #123 (comment) does help, but the output's whitespace is pretty messed up so I'd much prefer a solution that yields better whitespace.
from defopt.
@anntzer I'll add it my list to make a PR for definition_list
. Perhaps we can add to the docs that the description should be in RST. Are there other formats (e.g. github-flavored markdown, others)?
from defopt.
Related Issues (20)
- Add a registry class HOT 4
- When subclassing enum with data mixin, choices are not present on CLI HOT 8
- Consume command line arguments in 2 function calls HOT 10
- Support URLs in docstring
- Reject duplicate options for a single parameter rather than silently dropping one HOT 2
- Any way to indent within tool help text without runtime / linting error? HOT 1
- Add support for datetime.date and datetime.datetime parsers HOT 5
- Argument name suffixes as workaround for name collisions HOT 4
- Should `Optional[Tuple[type1]]` be supported HOT 7
- PyInstaller, Nuitka compatibility? HOT 5
- pin setuptools_scm < 6.4 to support python3.6 HOT 2
- Consume command line arguments in 2 calls - help text has only one call's parameters HOT 17
- Using keyword only dataclass with `defopt.run` gives a docutils warning HOT 1
- py.typed file? HOT 3
- TypeError: can only join an iterable HOT 2
- Requestion: add an option to convert underscores to hyphens for all arguments HOT 2
- [BUG] Pyinstaller does not resolve defopt import HOT 5
- Support repeated options that take a single argument (action=append) HOT 2
- Support for blank lines and indentation in argument help HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from defopt.