Compare commits
2 commits
e690b5bdab
...
4346d57dde
| Author | SHA256 | Date | |
|---|---|---|---|
| 4346d57dde | |||
| faeeab7e62 |
8 changed files with 205 additions and 0 deletions
5
CHANGELOG.md
Normal file
5
CHANGELOG.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
## 0.1.0a0 (2025-10-06)
|
||||
|
||||
### Feat
|
||||
|
||||
- first version
|
||||
21
locale/fr/LC_MESSAGES/rougail_user_data_commandline.po
Normal file
21
locale/fr/LC_MESSAGES/rougail_user_data_commandline.po
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR ORGANIZATION
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: 2025-10-06 20:50+0200\n"
|
||||
"PO-Revision-Date: 2025-10-06 20:52+0200\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_commandline/__init__.py:48
|
||||
msgid "\"commandline\" is not set in step.user_data"
|
||||
msgstr "\"commandline\" n'est pas défini dans step.user_data"
|
||||
21
locale/rougail_user_data_commandline.pot
Normal file
21
locale/rougail_user_data_commandline.pot
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR ORGANIZATION
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2025-10-06 20:53+0200\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_commandline/__init__.py:48
|
||||
msgid "\"commandline\" is not set in step.user_data"
|
||||
msgstr ""
|
||||
|
||||
44
pyproject.toml
Normal file
44
pyproject.toml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
[build-system]
|
||||
build-backend = "flit_core.buildapi"
|
||||
requires = ["flit_core >=3.8.0,<4"]
|
||||
|
||||
[project]
|
||||
name = "rougail.user_data_commandline"
|
||||
version = "0.1.0a0"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
readme = "README.md"
|
||||
description = "Rougail user_data Bitwarden"
|
||||
requires-python = ">=3.8"
|
||||
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 >= 1.1,<2",
|
||||
"tiramisu_cmdline_parser >= 0.6,<1",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Home = "https://forge.cloud.silique.fr/stove/rougail-user-data-commandline"
|
||||
|
||||
[tool.commitizen]
|
||||
name = "cz_conventional_commits"
|
||||
tag_format = "$version"
|
||||
version_scheme = "pep440"
|
||||
version_provider = "pep621"
|
||||
version_files = [
|
||||
"src/rougail/user_data_commandline/__version__.py",
|
||||
"pyproject.toml:version"
|
||||
]
|
||||
update_changelog_on_bump = true
|
||||
changelog_merge_prerelease = true
|
||||
85
src/rougail/user_data_commandline/__init__.py
Normal file
85
src/rougail/user_data_commandline/__init__.py
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
"""
|
||||
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 tiramisu_cmdline_parser import TiramisuCmdlineParser
|
||||
from rougail.error import ExtentionError
|
||||
|
||||
from .i18n import _
|
||||
from .__version__ import __version__
|
||||
|
||||
|
||||
class RougailUserDataCommandline:
|
||||
"""Load parameter for commande line
|
||||
"""
|
||||
def __init__(
|
||||
self,
|
||||
config: "Config",
|
||||
*,
|
||||
rougailconfig: "RougailConfig" = None,
|
||||
arguments = None,
|
||||
**kwargs,
|
||||
):
|
||||
# this is the tiramisu config object
|
||||
self.config = config.config.copy().unrestraint
|
||||
if rougailconfig is None:
|
||||
from rougail.config import RougailConfig
|
||||
|
||||
rougailconfig = RougailConfig
|
||||
user_data = rougailconfig["step.user_data"]
|
||||
if "commandline" not in user_data:
|
||||
user_data.append("commandline")
|
||||
rougailconfig["step.user_data"] = user_data
|
||||
user_data = rougailconfig["step.user_data"]
|
||||
if "commandline" not in user_data:
|
||||
raise ExtentionError(_('"commandline" is not set in step.user_data'))
|
||||
self.rougailconfig = rougailconfig
|
||||
self.arguments = arguments
|
||||
self.errors = []
|
||||
self.warnings = []
|
||||
self.parser = TiramisuCmdlineParser(
|
||||
self.config,
|
||||
exit_on_error=False,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self.parser.parse_args(self.arguments, valid_mandatory=False)
|
||||
except (SystemExit, ArgumentError) as err:
|
||||
self.errors.append(str(err))
|
||||
values = {}
|
||||
for key in self.config.value.exportation():
|
||||
option = self.config.option(key)
|
||||
if not option.isfollower():
|
||||
values[key] = self.config.option(key).value.get()
|
||||
else:
|
||||
values[key] = [self.config.option(key, index).value.get() for index in range(option.value.len())]
|
||||
return [
|
||||
{
|
||||
"source": 'Commandline',
|
||||
"errors": self.errors,
|
||||
"warnings": self.warnings,
|
||||
"values": values,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
RougailUserData = RougailUserDataCommandline
|
||||
|
||||
|
||||
__all__ = ("RougailUserDataCommandline",)
|
||||
2
src/rougail/user_data_commandline/__version__.py
Normal file
2
src/rougail/user_data_commandline/__version__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
__version__ = "0.1.0a0"
|
||||
|
||||
27
src/rougail/user_data_commandline/i18n.py
Normal file
27
src/rougail/user_data_commandline/i18n.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
"""Internationalisation utilities
|
||||
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_commandline", str(Path(__file__).parent / "locale"), fallback=True
|
||||
)
|
||||
|
||||
_ = t.gettext
|
||||
|
||||
Binary file not shown.
Loading…
Reference in a new issue