Compare commits
No commits in common. "346401912c70e9a5d0f79c6c2b08ca64feca3dbf" and "82e9e5bc3086d9785fcb337809f54e99c7f9f982" have entirely different histories.
346401912c
...
82e9e5bc30
14 changed files with 20 additions and 92 deletions
|
|
@ -1,10 +1,3 @@
|
||||||
## 0.2.0a18 (2025-05-14)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- able to lad config_file name from environement variable
|
|
||||||
- loads user datas before and after cli params
|
|
||||||
|
|
||||||
## 0.2.0a17 (2025-05-12)
|
## 0.2.0a17 (2025-05-12)
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"POT-Creation-Date: 2025-05-14 08:22+0200\n"
|
"POT-Creation-Date: 2025-05-12 08:44+0200\n"
|
||||||
"PO-Revision-Date: 2025-05-14 08:22+0200\n"
|
"PO-Revision-Date: 2025-05-12 08:44+0200\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: fr\n"
|
"Language: fr\n"
|
||||||
|
|
@ -16,15 +16,15 @@ msgstr ""
|
||||||
"Generated-By: pygettext.py 1.5\n"
|
"Generated-By: pygettext.py 1.5\n"
|
||||||
"X-Generator: Poedit 3.5\n"
|
"X-Generator: Poedit 3.5\n"
|
||||||
|
|
||||||
#: src/rougail/cli/__main__.py:170
|
#: src/rougail/cli/__main__.py:151
|
||||||
msgid "cannot find \"user_data\" module \"{0}\""
|
msgid "cannot find \"user_data\" module \"{0}\""
|
||||||
msgstr "ne peut trouve le module \"user_data\" \"{0}\""
|
msgstr "ne peut trouve le module \"user_data\" \"{0}\""
|
||||||
|
|
||||||
#: src/rougail/cli/__main__.py:214
|
#: src/rougail/cli/__main__.py:195
|
||||||
msgid "cannot find cli file for \"output_name\" module \"{0}\""
|
msgid "cannot find cli file for \"output_name\" module \"{0}\""
|
||||||
msgstr "ne peut trouve le fichier cli pour le module \"output_name\" \"{0}\""
|
msgstr "ne peut trouve le fichier cli pour le module \"output_name\" \"{0}\""
|
||||||
|
|
||||||
#: src/rougail/cli/__main__.py:240
|
#: src/rougail/cli/__main__.py:221
|
||||||
msgid "ERROR: {0}"
|
msgid "ERROR: {0}"
|
||||||
msgstr "ERREUR : {0}"
|
msgstr "ERREUR : {0}"
|
||||||
|
|
||||||
|
|
@ -37,15 +37,11 @@ msgid "Loads command line parameters from a file"
|
||||||
msgstr "Charger les paramètres de la ligne de commande depuis un fichier"
|
msgstr "Charger les paramètres de la ligne de commande depuis un fichier"
|
||||||
|
|
||||||
#: src/rougail/cli/config.py:39
|
#: src/rougail/cli/config.py:39
|
||||||
msgid "Displays debug informations"
|
msgid "Display debug informations"
|
||||||
msgstr "Afficher les informations de debug"
|
msgstr "Afficher les informations de debug"
|
||||||
|
|
||||||
#: src/rougail/cli/config.py:43
|
#: src/rougail/cli/config.py:43
|
||||||
msgid "Displays command line option warnings informations"
|
msgid "Display Rougail version and all componants"
|
||||||
msgstr "Afficher les avertissements de chargement des options de la ligne de commande"
|
|
||||||
|
|
||||||
#: src/rougail/cli/config.py:47
|
|
||||||
msgid "Displays Rougail version and all its components"
|
|
||||||
msgstr "Afficher la version de Rougail et de tous ces composants"
|
msgstr "Afficher la version de Rougail et de tous ces composants"
|
||||||
|
|
||||||
#~ msgid "do not display debug informations"
|
#~ msgid "do not display debug informations"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"POT-Creation-Date: 2025-05-14 08:25+0200\n"
|
"POT-Creation-Date: 2025-05-12 08:44+0200\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
@ -15,15 +15,15 @@ msgstr ""
|
||||||
"Generated-By: pygettext.py 1.5\n"
|
"Generated-By: pygettext.py 1.5\n"
|
||||||
|
|
||||||
|
|
||||||
#: src/rougail/cli/__main__.py:170
|
#: src/rougail/cli/__main__.py:151
|
||||||
msgid "cannot find \"user_data\" module \"{0}\""
|
msgid "cannot find \"user_data\" module \"{0}\""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/cli/__main__.py:214
|
#: src/rougail/cli/__main__.py:195
|
||||||
msgid "cannot find cli file for \"output_name\" module \"{0}\""
|
msgid "cannot find cli file for \"output_name\" module \"{0}\""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/cli/__main__.py:240
|
#: src/rougail/cli/__main__.py:221
|
||||||
msgid "ERROR: {0}"
|
msgid "ERROR: {0}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
@ -36,14 +36,10 @@ msgid "Loads command line parameters from a file"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/cli/config.py:39
|
#: src/rougail/cli/config.py:39
|
||||||
msgid "Displays debug informations"
|
msgid "Display debug informations"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/cli/config.py:43
|
#: src/rougail/cli/config.py:43
|
||||||
msgid "Displays command line option warnings informations"
|
msgid "Display Rougail version and all componants"
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/rougail/cli/config.py:47
|
|
||||||
msgid "Displays Rougail version and all its components"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rougail.cli"
|
name = "rougail.cli"
|
||||||
version = "0.2.0a18"
|
version = "0.2.0a17"
|
||||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
description = "CLI for Rougail"
|
description = "CLI for Rougail"
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License
|
||||||
along with Mtools. If not, see <http://www.gnu.org/licenses/>.
|
along with Mtools. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
from warnings import warn
|
from warnings import warn
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from sys import exit
|
from sys import exit
|
||||||
|
|
@ -42,9 +41,6 @@ except ImportError:
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
|
|
||||||
|
|
||||||
ENV_PREFIX = "ROUGAILCLI"
|
|
||||||
|
|
||||||
|
|
||||||
def _main(arguments, do_not_print):
|
def _main(arguments, do_not_print):
|
||||||
rougailconfig = get_rougail_config(
|
rougailconfig = get_rougail_config(
|
||||||
backward_compatibility=False, add_extra_options=False
|
backward_compatibility=False, add_extra_options=False
|
||||||
|
|
@ -61,10 +57,7 @@ def _main(arguments, do_not_print):
|
||||||
}
|
}
|
||||||
fake_user_datas = []
|
fake_user_datas = []
|
||||||
if RougailUserDataYaml:
|
if RougailUserDataYaml:
|
||||||
cli_config_file_key = f"{ENV_PREFIX}_CLI.CONFIG_FILE"
|
config_file = cmd_config.forcepermissive.option("cli.config_file").value.get()
|
||||||
config_file = os.environ.pop(cli_config_file_key, None)
|
|
||||||
if not config_file:
|
|
||||||
config_file = cmd_config.forcepermissive.option("cli.config_file").value.get()
|
|
||||||
if Path(config_file).is_file():
|
if Path(config_file).is_file():
|
||||||
fake_rougail_config = {
|
fake_rougail_config = {
|
||||||
"step.user_data": "yaml",
|
"step.user_data": "yaml",
|
||||||
|
|
@ -77,7 +70,7 @@ def _main(arguments, do_not_print):
|
||||||
if RougailUserDataEnvironment:
|
if RougailUserDataEnvironment:
|
||||||
fake_rougail_config = {
|
fake_rougail_config = {
|
||||||
"step.user_data": "environment",
|
"step.user_data": "environment",
|
||||||
"environment.default_environment_name": ENV_PREFIX,
|
"environment.default_environment_name": "ROUGAILCLI",
|
||||||
}
|
}
|
||||||
fake_user_datas.extend(
|
fake_user_datas.extend(
|
||||||
RougailUserDataEnvironment(
|
RougailUserDataEnvironment(
|
||||||
|
|
@ -96,7 +89,7 @@ def _main(arguments, do_not_print):
|
||||||
parser.parse_args(arguments)
|
parser.parse_args(arguments)
|
||||||
if user_datas:
|
if user_datas:
|
||||||
user_data = UserDatas(cmd_config).user_datas(user_datas, user_datas_type="values")
|
user_data = UserDatas(cmd_config).user_datas(user_datas, user_datas_type="values")
|
||||||
if user_data["warnings"] and cmd_config.option("cli.warnings").value.get():
|
if user_data["warnings"]:
|
||||||
for warning in user_data["warnings"]:
|
for warning in user_data["warnings"]:
|
||||||
warn(warning)
|
warn(warning)
|
||||||
if user_data["errors"]:
|
if user_data["errors"]:
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.2.0a18"
|
__version__ = "0.2.0a17"
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,11 @@ cli:
|
||||||
default: .rougailcli.yml
|
default: .rougailcli.yml
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
description: {_('Displays debug informations')}
|
description: {_('Display debug informations')}
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
warnings:
|
|
||||||
description: {_('Displays command line option warnings informations')}
|
|
||||||
default: true
|
|
||||||
|
|
||||||
versions:
|
versions:
|
||||||
description: {_('Displays Rougail version and all its components')}
|
description: {_('Display Rougail version and all componants')}
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
load_config:
|
load_config:
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
main_dictionaries:
|
|
||||||
- structures
|
|
||||||
step:
|
|
||||||
output: doc
|
|
||||||
doc:
|
|
||||||
output_format: json
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
main_dictionaries:
|
|
||||||
- structures
|
|
||||||
step:
|
|
||||||
output: doc
|
|
||||||
doc:
|
|
||||||
output_format: console
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
"\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503\u001b[1m \u001b[0m\u001b[1mVariable \u001b[0m\u001b[1m \u001b[0m\u2503\u001b[1m \u001b[0m\u001b[1mDescription \u001b[0m\u001b[1m \u001b[0m\u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 \u001b[1mmy_variable\u001b[0m \u2502 A description. \u2502\n\u2502 \u001b[1;7m string \u001b[0m \u001b[1;7m mandatory \u001b[0m \u2502 \u001b[1mDefault\u001b[0m: my_value \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n"
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
my_variable: my_value # a description
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
"{\n \"my_variable\": {\n \"type\": \"variable\",\n \"default\": \"my_value\",\n \"properties\": [\n {\n \"type\": \"type\",\n \"name\": \"string\"\n },\n {\n \"type\": \"property\",\n \"name\": \"mandatory\"\n }\n ],\n \"paths\": [\n \"my_variable\"\n ],\n \"names\": [\n \"my_variable\"\n ],\n \"descriptions\": [\n \"A description.\"\n ]\n }\n}"
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import os
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from contextlib import chdir
|
from contextlib import chdir
|
||||||
from json import dumps, loads
|
from json import dumps, loads
|
||||||
|
|
@ -79,28 +78,3 @@ def test_cli_version_user_data_disabled():
|
||||||
with filename.open() as fh:
|
with filename.open() as fh:
|
||||||
data = loads(fh.read())
|
data = loads(fh.read())
|
||||||
assert ret == (True, data)
|
assert ret == (True, data)
|
||||||
|
|
||||||
|
|
||||||
def test_cli_rougailcli():
|
|
||||||
with chdir(test_dir / 'rougailcli_file'):
|
|
||||||
ret = main([], do_not_print=True)
|
|
||||||
filename = Path('yaml.txt')
|
|
||||||
if not filename.is_file():
|
|
||||||
with filename.open('w') as fh:
|
|
||||||
fh.write(dumps(ret[1]))
|
|
||||||
with filename.open() as fh:
|
|
||||||
data = loads(fh.read())
|
|
||||||
assert ret == (True, data)
|
|
||||||
|
|
||||||
|
|
||||||
def test_cli_alt_rougailcli():
|
|
||||||
with chdir(test_dir / 'rougailcli_file'):
|
|
||||||
os.environ["ROUGAILCLI_CLI.CONFIG_FILE"] = 'alt_rougailcli.yml'
|
|
||||||
ret = main([], do_not_print=True)
|
|
||||||
filename = Path('console.txt')
|
|
||||||
if not filename.is_file():
|
|
||||||
with filename.open('w') as fh:
|
|
||||||
fh.write(dumps(ret[1]))
|
|
||||||
with filename.open() as fh:
|
|
||||||
data = loads(fh.read())
|
|
||||||
assert ret == (True, data)
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue