Support default values for options per file
See original GitHub issueIt would be nice to specify need option values not only globally but per file as well.
The default option values is currently available on a per-project basis in sphinx-needs:
needs_global_options = {
'my_option': 'my_global_value'
}
However, in big projects, requirements with different “standard options” exist, and per-file grouping is a natural strategy to structure them. In projects with some mandatory requirements attributes, repeated options lead to visual noise (repetitive content repeated a lot with little additional information).
Now:
.. need::
:id: NEED_ID_1
:my_option: same_value
:some-other-option: value1
.. need::
:id: NEED_ID_2
:my_option: same_value
:some-other-option: value2
.. need::
:id: NEED_ID_3
:my_option: same_value
:some-other-option: value2
Later:
.. needoptions:
:my_option: same_value
.. need::
:id: NEED_ID_2
:some-other-option: value1
.. need::
:id: NEED_ID_2
:some-other-option: value2
.. need::
:id: NEED_ID_3
:some-other-option: value2
The needoptions
shall apply to all needs in the current page starting where the directive appears. Probably there could be a filter
option as well to filter certain need types (within the page).
Idea came from @arwedus 😃
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (12 by maintainers)
Top Results From Across the Web
Set default values for fields or controls - Microsoft Support
Click the All tab in the property sheet, locate the Default Value property, and then enter your default value. Press CTRL+S to save...
Read more >Support click.option with default values / optional arguments
Since the default value always applies, there should be a way to differentiate between the following options usage: file.py file.py --foo
Read more >Does Java support default parameter values? - Stack Overflow
No, the structure you found is how Java handles it, (that is, with overloading instead of default parameters).
Read more >Compiler option defaults - IBM
To find out the current defaults, compile a program with only the SOURCE compiler option specified. The compiler listing shows the options that...
Read more >CLI Options with Help - Typer - tiangolo
We are replacing the default values we had before with typer.Option() . As we no longer have a default value there, the first...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Good points and I agree.
conf.py
should not be too related to the internal documentation structure.I also thought that your case is somehow related to inheritance.
Here is an idea:
Need can inherit from any other need
REAL_NEED_001
will havestatus: open
andtags: my_tag
.The user can decide, if a need like
basic_001
shall be shown or gets hidden.basic_001
could also get automaticallyinherited_from: True
as option, so that all needs which are used for inheritance could get the hide-option automatically vianeeds_global_options
.This somehow feels like
needextend
, but only the other way around.Beside the overall inheritance idea, wouldn’t
needextend
be a solution for your case?Regarding the correct docname, you can check the set value by using the
debug
layout in one of your need objects:Docs: https://sphinxcontrib-needs.readthedocs.io/en/latest/layout_styles.html#EX_DEBUG This shows you also all the other option values.
In your case I think the correct one is
work_products/software_wp/sw_req_eng_wp/sw_requirements_specification_wp
, without the file extension.