File tree Expand file tree Collapse file tree 3 files changed +38
-3
lines changed Expand file tree Collapse file tree 3 files changed +38
-3
lines changed Original file line number Diff line number Diff line change 2323 Tracker ,
2424 WriteKwargs ,
2525)
26- from janus_core .cli .utils import yaml_converter_callback
26+ from janus_core .cli .utils import deprecated_option , yaml_converter_callback
2727
2828app = Typer ()
2929
@@ -127,7 +127,12 @@ def geomopt(
127127 ] = None ,
128128 filter_func : Annotated [
129129 str | None ,
130- Option (help = "Deprecated. Please use --filter" , rich_help_panel = "Calculation" ),
130+ Option (
131+ help = "Deprecated. Please use --filter" ,
132+ rich_help_panel = "Calculation" ,
133+ callback = deprecated_option ,
134+ hidden = True ,
135+ ),
131136 ] = None ,
132137 pressure : Annotated [
133138 float ,
Original file line number Diff line number Diff line change 99from click import Choice
1010from typer import Option
1111
12+ from janus_core .cli .utils import deprecated_option
1213from janus_core .helpers .janus_types import Architectures , Devices
1314
1415if TYPE_CHECKING :
@@ -101,7 +102,12 @@ def __str__(self) -> str:
101102]
102103ModelPath = Annotated [
103104 str | None ,
104- Option (help = "Deprecated. Please use --model" , rich_help_panel = "MLIP calculator" ),
105+ Option (
106+ help = "Deprecated. Please use --model" ,
107+ rich_help_panel = "MLIP calculator" ,
108+ callback = deprecated_option ,
109+ hidden = True ,
110+ ),
105111]
106112
107113FilePrefix = Annotated [
Original file line number Diff line number Diff line change 99from pathlib import Path
1010from typing import TYPE_CHECKING , Any
1111
12+ from typer import CallbackParam , secho
13+ from typer .colors import YELLOW
1214from typer_config import conf_callback_factory , yaml_loader
1315import yaml
1416
@@ -409,3 +411,25 @@ def parse_correlation_kwargs(kwargs: CorrelationKwargs) -> list[dict]:
409411
410412 parsed_kwargs .append (cor_kwargs )
411413 return parsed_kwargs
414+
415+
416+ # Callback to print warning for deprecated options
417+ def deprecated_option (param : CallbackParam , value : Any ):
418+ """
419+ Print warning for deprecated option.
420+
421+ Parameters
422+ ----------
423+ param
424+ Callback parameters from typer.
425+ value
426+ Value of parameter.
427+
428+ Returns
429+ -------
430+ Any
431+ Unmodified parameter value.
432+ """
433+ if value :
434+ secho (f"Warning: --{ param .name } is deprecated." , fg = YELLOW )
435+ return value
You can’t perform that action at this time.
0 commit comments