rougail-cli/src/rougail/cli/config.py

146 lines
4.6 KiB
Python
Raw Normal View History

2025-02-17 11:17:23 +01:00
"""
Silique (https://www.silique.fr)
2026-01-03 13:02:21 +01:00
Copyright (C) 2025-2026
2025-02-17 11:17:23 +01:00
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from .i18n import _
def get_rougail_config(
*,
backward_compatibility: bool = True, # pylint: disable=unused-argument
) -> dict:
options = f"""
cli:
2025-03-31 16:38:01 +02:00
description: {_('Command line options')}
2025-12-29 20:54:41 +01:00
help: {_('It is possible to use Rougail directly from the command line. This makes it easy to define and configure the loaded user data and to define the desired output.')}
2025-03-31 09:30:29 +02:00
config_file:
2025-05-09 07:45:42 +02:00
description: {_('Loads command line parameters from a file')}
2025-03-31 09:30:29 +02:00
type: unix_filename
commandline: false
params:
allow_relative: true
2025-12-19 19:02:47 +01:00
default:
- .rougailcli.yml
2025-03-31 09:30:29 +02:00
2025-09-29 12:16:49 +02:00
debug: false # {_('Displays debug informations')}
2025-04-09 21:22:41 +02:00
2025-09-29 12:16:49 +02:00
warnings: true # {_('Displays command line option warnings informations')}
2025-09-29 12:16:49 +02:00
versions: false # {_('Displays Rougail version and all its components')}
2025-05-02 08:09:14 +02:00
2025-12-22 15:32:21 +01:00
invalid_user_data_error: false # {_("Invalid value in user data is not allowed")}
2025-12-22 15:32:21 +01:00
unknown_user_data_error: false # {_("Unknown variable in user data is not allowed")}
2025-11-02 18:44:17 +01:00
layers:
2025-12-22 15:32:21 +01:00
description: {_('Open each user data in separate layers')}
2025-11-02 18:44:17 +01:00
default: false
hidden:
jinja: |-
{{{{ __.step.user_data is propertyerror or __.step.user_data | length < 2 }}}}
return_type: boolean
2025-12-22 15:32:21 +01:00
description: {_('if only one user data is set in "__.step.user_data"')}
2025-11-02 18:44:17 +01:00
2025-05-02 08:09:14 +02:00
load_config:
default: true
hidden: true
2025-09-29 12:16:49 +02:00
2026-01-03 13:02:21 +01:00
load_from_tiramisu_cache:
description: {_('Use cache for load Tiramisu objects')}
help: {_('It will only be loaded from the cache if it already exists')}
default: false
disabled:
variable: __.tiramisu_cache
when: null
2025-09-29 12:16:49 +02:00
read_write: false # {_('Configuration in output step is in read_write mode')}
2025-12-19 19:02:47 +01:00
description_type:
description: {_('Type of variables description')}
help: >-
{_("""To identify different variables, we use the variable description. There are four types of description:
2025-12-29 20:39:55 +01:00
- path_and_description: which contains the variable path followed by its description
2025-12-19 19:02:47 +01:00
- name_and_description: which contains the variable name followed by its description
- path: the variable's path
- name: the variable name
- description: the variable's description""")}
choices:
2025-12-29 20:39:55 +01:00
- path_and_description
2025-12-19 19:02:47 +01:00
- name_and_description
- path
- name
- description
default: description
2025-12-30 10:57:40 +01:00
inaccessible_read_only_modes:
description: {_('Modes that should not be accessible in read_only mode')}
multi: true
mandatory: false
disabled:
jinja: |
{{{{ not modes_level }}}}
return_type: boolean
description: {_('if any mode is set in "modes_level"')}
validators:
- type: jinja
jinja: |
{{% if _.inaccessible_read_only_modes not in modes_level %}}
not in modes_level ({{modes_level}})
{{% endif %}}
description: {_('mode must exists in "modes_level"')}
inaccessible_read_write_modes:
description: {_('Modes that should not be accessible in read_write mode')}
multi: true
mandatory: false
disabled:
jinja: |
2025-12-22 15:32:21 +01:00
{{{{ not modes_level }}}}
return_type: boolean
description: {_('if any mode is set in "modes_level"')}
validators:
- type: jinja
jinja: |
{{% if _.inaccessible_read_write_modes not in modes_level %}}
not in modes_level ({{modes_level}})
{{% endif %}}
2025-12-22 15:32:21 +01:00
description: {_('mode must exists in "modes_level"')}
inaccessible_modes:
description: {_('Modes that should not be accessible')}
multi: true
mandatory: false
disabled:
jinja: |
2025-12-22 15:32:21 +01:00
{{{{ not modes_level }}}}
return_type: boolean
description: {_('if any mode is set in "modes_level"')}
validators:
- type: jinja
jinja: |
{{% if _.inaccessible_modes not in modes_level %}}
not in modes_level ({{modes_level}})
{{% endif %}}
2025-12-22 15:32:21 +01:00
description: {_('mode must exists in "modes_level"')}
2025-02-17 11:17:23 +01:00
"""
return {
"options": options,
"process": None,
}