mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-28 09:47:20 +02:00
[app] Add --env-help
command line option
Add a new CLI option to print the available Meshroom environment variables and their descriptions.
This commit is contained in:
parent
968a5d0471
commit
c20ecaadd2
2 changed files with 26 additions and 1 deletions
|
@ -4,8 +4,10 @@ Meshroom environment variable management.
|
|||
|
||||
__all__ = [
|
||||
"EnvVar",
|
||||
"EnvVarHelpAction",
|
||||
]
|
||||
|
||||
import argparse
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
|
@ -51,3 +53,18 @@ class EnvVar(Enum):
|
|||
return value.lower() in {"true", "1", "on"}
|
||||
return valueType(value)
|
||||
|
||||
@classmethod
|
||||
def help(cls) -> str:
|
||||
"""Return a formatted string with the details of each environment variables."""
|
||||
return "\n".join([f"{var.name}: {var.value}" for var in cls])
|
||||
|
||||
|
||||
class EnvVarHelpAction(argparse.Action):
|
||||
"""Argparse action for printing Meshroom environment variables help and exit."""
|
||||
|
||||
DEFAULT_HELP = "Print Meshroom environment variables help and exit."
|
||||
|
||||
def __call__(self, parser, namespace, value, option_string=None):
|
||||
print("Meshroom environment variables:")
|
||||
print(EnvVar.help())
|
||||
sys.exit(0)
|
||||
|
|
|
@ -17,7 +17,7 @@ from meshroom.core import nodesDesc
|
|||
from meshroom.core.taskManager import TaskManager
|
||||
from meshroom.common import Property, Variant, Signal, Slot
|
||||
|
||||
from meshroom.env import EnvVar
|
||||
from meshroom.env import EnvVar, EnvVarHelpAction
|
||||
|
||||
from meshroom.ui import components
|
||||
from meshroom.ui.components.clipboard import ClipboardHelper
|
||||
|
@ -185,6 +185,14 @@ Additional Resources:
|
|||
+ '\n'.join([' - ' + p for p in meshroom.core.pipelineTemplates]),
|
||||
)
|
||||
|
||||
advanced_group = parser.add_argument_group("Advanced Options")
|
||||
advanced_group.add_argument(
|
||||
"--env-help",
|
||||
action=EnvVarHelpAction,
|
||||
nargs=0,
|
||||
help=EnvVarHelpAction.DEFAULT_HELP,
|
||||
)
|
||||
|
||||
return parser.parse_args(args[1:])
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue