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

98 lines
2.7 KiB
Python
Raw Normal View History

2025-02-17 11:17:23 +01:00
"""
Silique (https://www.silique.fr)
Copyright (C) 2025
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-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
default: .rougailcli.yml
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
invalid_user_datas_error: false # {_("Invalid value in user datas is not allowed")}
unknown_user_datas_error: false # {_("Unknown variable in user datas is not allowed")}
2025-11-02 18:44:17 +01:00
layers:
description: {_('Open each user datas in separate layers')}
default: false
hidden:
jinja: |-
{{{{ __.step.user_data is propertyerror or __.step.user_data | length < 2 }}}}
return_type: boolean
2025-05-02 08:09:14 +02:00
load_config:
default: true
hidden: true
2025-09-29 12:16:49 +02:00
read_write: false # {_('Configuration in output step is in read_write mode')}
inaccessible_read_write_modes:
description: {_('Modes that should not be accessible in read_write mode')}
multi: true
mandatory: false
disabled:
jinja: |
{{% if not modes_level %}}
No mode
{{% endif %}}
validators:
- type: jinja
jinja: |
{{% if _.inaccessible_read_write_modes not in modes_level %}}
not in modes_level ({{modes_level}})
{{% endif %}}
inaccessible_modes:
description: {_('Modes that should not be accessible')}
multi: true
mandatory: false
disabled:
jinja: |
{{% if not modes_level %}}
No mode
{{% endif %}}
validators:
- type: jinja
jinja: |
{{% if _.inaccessible_modes not in modes_level %}}
not in modes_level ({{modes_level}})
{{% endif %}}
2025-02-17 11:17:23 +01:00
"""
return {
"options": options,
"process": None,
}