Compare commits
No commits in common. "9b6361a5dc70df3e03fdae64be6da60435fd78d2" and "da16ffffc8302759e38727d15464296d02145358" have entirely different histories.
9b6361a5dc
...
da16ffffc8
11 changed files with 72 additions and 196 deletions
|
|
@ -1,6 +0,0 @@
|
||||||
## 0.1.0a0 (2025-11-06)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- update for last rougail version
|
|
||||||
- support of password type
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
# SOME DESCRIPTIVE TITLE.
|
|
||||||
# Copyright (C) YEAR ORGANIZATION
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: \n"
|
|
||||||
"POT-Creation-Date: 2025-11-06 06:11+0100\n"
|
|
||||||
"PO-Revision-Date: 2025-11-06 06:11+0100\n"
|
|
||||||
"Last-Translator: \n"
|
|
||||||
"Language-Team: \n"
|
|
||||||
"Language: fr\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Generated-By: pygettext.py 1.5\n"
|
|
||||||
"X-Generator: Poedit 3.7\n"
|
|
||||||
|
|
||||||
#: src/rougail/user_data_questionary/config.py:31
|
|
||||||
msgid "Define values interactivly"
|
|
||||||
msgstr "Définir des valeurs interactivement"
|
|
||||||
|
|
||||||
#: src/rougail/user_data_questionary/config.py:39
|
|
||||||
msgid "Ask values only for mandatories variables without any value"
|
|
||||||
msgstr "Demander des valeurs uniquement pour des variables obligatoires sans valeur"
|
|
||||||
|
|
||||||
#: src/rougail/user_data_questionary/config.py:44
|
|
||||||
msgid "Show secrets instead of obscuring them"
|
|
||||||
msgstr "Afficher les secrets plutôt que des obscurcir."
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
# SOME DESCRIPTIVE TITLE.
|
|
||||||
# Copyright (C) YEAR ORGANIZATION
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
|
||||||
"POT-Creation-Date: 2025-11-06 06:11+0100\n"
|
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Generated-By: pygettext.py 1.5\n"
|
|
||||||
|
|
||||||
|
|
||||||
#: src/rougail/user_data_questionary/config.py:31
|
|
||||||
msgid "Define values interactivly"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/rougail/user_data_questionary/config.py:39
|
|
||||||
msgid "Ask values only for mandatories variables without any value"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/rougail/user_data_questionary/config.py:44
|
|
||||||
msgid "Show secrets instead of obscuring them"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
[build-system]
|
|
||||||
build-backend = "flit_core.buildapi"
|
|
||||||
requires = ["flit_core >=3.8.0,<4"]
|
|
||||||
|
|
||||||
[project]
|
|
||||||
name = "rougail.user_data_questionary"
|
|
||||||
version = "0.1.0a0"
|
|
||||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
|
||||||
readme = "README.md"
|
|
||||||
description = "Rougail user_data questionary"
|
|
||||||
requires-python = ">=3.11"
|
|
||||||
license = {file = "LICENSE"}
|
|
||||||
classifiers = [
|
|
||||||
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
|
|
||||||
"Programming Language :: Python",
|
|
||||||
"Programming Language :: Python :: 3.11",
|
|
||||||
"Programming Language :: Python :: 3.12",
|
|
||||||
"Programming Language :: Python :: 3.13",
|
|
||||||
"Programming Language :: Python :: 3.14",
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
"Operating System :: OS Independent",
|
|
||||||
"Natural Language :: English",
|
|
||||||
"Natural Language :: French",
|
|
||||||
|
|
||||||
]
|
|
||||||
dependencies = [
|
|
||||||
"rougail-base >= 1.1,<2",
|
|
||||||
"questionary ~= 2.1.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[project.urls]
|
|
||||||
Home = "https://forge.cloud.silique.fr/stove/rougail-user-data-questionary"
|
|
||||||
|
|
||||||
[tool.commitizen]
|
|
||||||
name = "cz_conventional_commits"
|
|
||||||
tag_format = "$version"
|
|
||||||
version_scheme = "pep440"
|
|
||||||
version_provider = "pep621"
|
|
||||||
version_files = [
|
|
||||||
"src/rougail/user_data_questionary/__version__.py",
|
|
||||||
"pyproject.toml:version"
|
|
||||||
]
|
|
||||||
update_changelog_on_bump = true
|
|
||||||
changelog_merge_prerelease = true
|
|
||||||
|
|
@ -1,5 +1,2 @@
|
||||||
from .data import RougailUserDataQuestionary
|
from .data import RougailUserDataQuestionary
|
||||||
from .__version__ import __version__
|
|
||||||
|
|
||||||
RougailUserData = RougailUserDataQuestionary
|
|
||||||
__all__ = ('RougailUserDataQuestionary',)
|
__all__ = ('RougailUserDataQuestionary',)
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
__version__ = "0.1.0a0"
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
"""
|
||||||
|
Cli code for Rougail-user-data-questionary
|
||||||
|
|
||||||
|
Silique (https://www.silique.fr)
|
||||||
|
Copyright (C) 2024
|
||||||
|
|
||||||
|
distribued with GPL-2 or later license
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
"""
|
||||||
|
from .data import RougailUserDataQuestionary
|
||||||
|
|
||||||
|
|
||||||
|
def run(rougailconfig,
|
||||||
|
config,
|
||||||
|
user_datas,
|
||||||
|
):
|
||||||
|
RougailUserDataQuestionary(config,
|
||||||
|
rougailconfig=rougailconfig,
|
||||||
|
).run()
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ('run',)
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
"""
|
"""
|
||||||
|
Config file for Rougail-user-data-questionary
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2024-2025
|
Copyright (C) 2024
|
||||||
|
|
||||||
distribued with GPL-2 or later license
|
distribued with GPL-2 or later license
|
||||||
|
|
||||||
|
|
@ -18,33 +20,32 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
|
def get_rougail_config(*,
|
||||||
from .i18n import _
|
backward_compatibility=True,
|
||||||
|
) -> dict:
|
||||||
|
options = """
|
||||||
def get_rougail_config(
|
|
||||||
*,
|
|
||||||
backward_compatibility=True,
|
|
||||||
) -> dict:
|
|
||||||
options = f"""
|
|
||||||
questionary:
|
questionary:
|
||||||
description: {_("Define values interactivly")}
|
description: Define value interactivly
|
||||||
disabled:
|
disabled:
|
||||||
|
type: jinja
|
||||||
jinja: |
|
jinja: |
|
||||||
{{% if step.user_data is not propertyerror and 'questionary' not in step.user_data %}}
|
{% if 'questionary' not in step.user_data %}
|
||||||
disabled
|
disabled
|
||||||
{{% endif %}}
|
{% endif %}
|
||||||
|
|
||||||
mandatory:
|
mandatory:
|
||||||
description: {_("Ask values only for mandatories variables without any value")}
|
description: Ask values only for mandatories variables without any value
|
||||||
|
negative_description: Ask values all variables
|
||||||
alternative_name: qm
|
alternative_name: qm
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
show_secrets:
|
show_secrets:
|
||||||
description: {_("Show secrets instead of obscuring them")}
|
description: Show secrets instead of obscuring them
|
||||||
|
negative_description: Obscuring secrets instead of show them
|
||||||
alternative_name: qs
|
alternative_name: qs
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default:
|
||||||
|
type: variable
|
||||||
|
variable: __.exporter.show_secrets
|
||||||
|
optional: true
|
||||||
"""
|
"""
|
||||||
return {'name': 'questionary',
|
return {'name': 'questionary',
|
||||||
'process': 'user data',
|
'process': 'user data',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2024-2025
|
Copyright (C) 2024
|
||||||
|
|
||||||
distribued with GPL-2 or later license
|
distribued with GPL-2 or later license
|
||||||
|
|
||||||
|
|
@ -18,24 +19,17 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
|
from rougail.object_model import CONVERT_OPTION
|
||||||
|
from rougail.config import RougailConfig
|
||||||
|
from tiramisu.error import ValueOptionError
|
||||||
from questionary import text, select, confirm, password, Validator, ValidationError, print as qprint
|
from questionary import text, select, confirm, password, Validator, ValidationError, print as qprint
|
||||||
|
|
||||||
from rougail.tiramisu import CONVERT_OPTION
|
|
||||||
from rougail.config import RougailConfig
|
|
||||||
from rougail.error import ExtentionError
|
|
||||||
from tiramisu.error import ValueOptionError
|
|
||||||
|
|
||||||
|
|
||||||
class RougailUserDataQuestionary:
|
class RougailUserDataQuestionary:
|
||||||
interactive_user_datas = True
|
def __init__(self,
|
||||||
|
config: 'Config',
|
||||||
def __init__(
|
*,
|
||||||
self,
|
rougailconfig: RougailConfig=None,
|
||||||
config: "Config",
|
):
|
||||||
*,
|
|
||||||
rougailconfig: "RougailConfig" = None,
|
|
||||||
):
|
|
||||||
# this is the tiramisu config object
|
|
||||||
self.config = config
|
self.config = config
|
||||||
if rougailconfig is None:
|
if rougailconfig is None:
|
||||||
rougailconfig = RougailConfig
|
rougailconfig = RougailConfig
|
||||||
|
|
@ -45,14 +39,12 @@ class RougailUserDataQuestionary:
|
||||||
rougailconfig['step.user_data'] = user_data
|
rougailconfig['step.user_data'] = user_data
|
||||||
user_data = rougailconfig['step.user_data']
|
user_data = rougailconfig['step.user_data']
|
||||||
if 'questionary' not in user_data:
|
if 'questionary' not in user_data:
|
||||||
raise ExtentionError('questionary is not set in step.user_data')
|
raise Exception('questionary is not set in step.user_data')
|
||||||
self.rougailconfig = rougailconfig
|
self.rougailconfig = rougailconfig
|
||||||
self.errors = []
|
self.errors = []
|
||||||
self.warnings = []
|
self.warnings = []
|
||||||
|
|
||||||
def run(
|
def run(self):
|
||||||
self,
|
|
||||||
) -> None:
|
|
||||||
self.config.property.read_write()
|
self.config.property.read_write()
|
||||||
if self.rougailconfig['questionary.mandatory']:
|
if self.rougailconfig['questionary.mandatory']:
|
||||||
current_titles = []
|
current_titles = []
|
||||||
|
|
@ -76,17 +68,6 @@ class RougailUserDataQuestionary:
|
||||||
else:
|
else:
|
||||||
self.parse(self.config)
|
self.parse(self.config)
|
||||||
self.config.property.read_only()
|
self.config.property.read_only()
|
||||||
return {'errors': [],
|
|
||||||
'warnings': [],
|
|
||||||
}
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
"source": 'Questionary',
|
|
||||||
"errors": self.errors,
|
|
||||||
"warnings": self.warnings,
|
|
||||||
"values": values,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
def parse(self, config, title_level=0):
|
def parse(self, config, title_level=0):
|
||||||
for option in config:
|
for option in config:
|
||||||
|
|
@ -112,7 +93,6 @@ class RougailUserDataQuestionary:
|
||||||
'func': type_obj,
|
'func': type_obj,
|
||||||
}
|
}
|
||||||
RougailValidator.ismulti = ismulti
|
RougailValidator.ismulti = ismulti
|
||||||
ori_default = default
|
|
||||||
if option_type == 'choice':
|
if option_type == 'choice':
|
||||||
question_funtion = select
|
question_funtion = select
|
||||||
RougailValidator.default = default
|
RougailValidator.default = default
|
||||||
|
|
@ -128,13 +108,11 @@ class RougailUserDataQuestionary:
|
||||||
if ismulti:
|
if ismulti:
|
||||||
kwargs['multiline'] = True
|
kwargs['multiline'] = True
|
||||||
if default:
|
if default:
|
||||||
kwargs['default'] = "\n".join([str(d) for d in default])
|
kwargs['default'] = "\n".join(default)
|
||||||
elif default is not None:
|
elif default is not None:
|
||||||
if isinstance(default, (int, float)):
|
|
||||||
default = str(default)
|
|
||||||
kwargs['default'] = default
|
kwargs['default'] = default
|
||||||
value = RougailValidator().convert_value(question_funtion(*args, **kwargs).ask(), False)
|
value = RougailValidator().convert_value(question_funtion(*args, **kwargs).ask(), False)
|
||||||
if isdefault and value == ori_default:
|
if isdefault and value == default:
|
||||||
option.value.reset()
|
option.value.reset()
|
||||||
else:
|
else:
|
||||||
option.value.set(value)
|
option.value.set(value)
|
||||||
|
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
"""
|
|
||||||
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 gettext import translation
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
t = translation(
|
|
||||||
"rougail_user_data_questionary", str(Path(__file__).parent / "locale"), fallback=True
|
|
||||||
)
|
|
||||||
|
|
||||||
_ = t.gettext
|
|
||||||
Binary file not shown.
Loading…
Reference in a new issue