Skip to content

Commit 47216e9

Browse files
committed
feature(robotcode): add new command to show informations about configuration setttings
1 parent 3c9f94f commit 47216e9

File tree

10 files changed

+519
-523
lines changed

10 files changed

+519
-523
lines changed

Diff for: .vscode/launch.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@
6161
// "--help"
6262
// "tests1"
6363
// "profiles",
64-
6564
// "show",
6665
// "list",
6766
// "--format",
6867
// "toml"
69-
"profiles",
70-
"show",
71-
"--no-evaluate"
68+
"config",
69+
"info",
70+
"desc",
71+
"*"
7272
]
7373
},
7474
{

Diff for: bundled/tool/cli/__main__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ def update_sys_path(path_to_add: str, strategy: str) -> None:
2424

2525
from robotcode.cli import robotcode
2626

27-
sys.exit(robotcode())
27+
sys.exit(robotcode(windows_expand_args=False))

Diff for: etc/robot.toml.json

+280-244
Large diffs are not rendered by default.

Diff for: packages/core/src/robotcode/core/dataclasses.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ def __get_config(obj: Any, entry_protocol: Type[_T]) -> _T:
127127
return cast(_T, __get_default_config())
128128

129129

130-
def __encode_case(obj: Any, field: dataclasses.Field) -> str: # type: ignore
130+
def encode_case(obj: Any, field: dataclasses.Field) -> str: # type: ignore
131131
alias = field.metadata.get("alias", None)
132132
if alias:
133133
return str(alias)
134134

135135
return __get_config(obj, HasCaseEncoder)._encode_case(field.name) # type: ignore
136136

137137

138-
def __decode_case(type: Type[_T], name: str) -> str:
138+
def decode_case(type: Type[_T], name: str) -> str:
139139
if dataclasses.is_dataclass(type):
140140
field = next(
141141
(f for f in dataclasses.fields(type) if f.metadata.get("alias", None) == name),
@@ -153,7 +153,7 @@ def __default(o: Any) -> Any:
153153
name: value
154154
for name, value, field in (
155155
(
156-
__encode_case(o, field),
156+
encode_case(o, field),
157157
getattr(o, field.name),
158158
field,
159159
)
@@ -263,7 +263,7 @@ def from_dict(
263263
if origin is Literal:
264264
continue
265265

266-
cased_value: Dict[str, Any] = {__decode_case(t, k): v for k, v in value.items()}
266+
cased_value: Dict[str, Any] = {decode_case(t, k): v for k, v in value.items()}
267267
type_hints = get_type_hints(origin or t)
268268
try:
269269
signature = inspect.signature(origin or t)

Diff for: packages/plugin/src/robotcode/plugin/__init__.py

+25
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,30 @@ def print_dict(self, config: Dict[str, Any], format: OutputFormat) -> None:
113113

114114
return
115115

116+
def echo(
117+
self, message: Union[str, Callable[[], Any], None], file: Optional[IO[AnyStr]] = None, nl: bool = True
118+
) -> None:
119+
click.secho(
120+
message() if callable(message) else message,
121+
file=file,
122+
nl=nl,
123+
color=self.colored,
124+
)
125+
126+
def echo_as_markdown(self, text: str) -> None:
127+
if self.colored:
128+
try:
129+
from rich.console import Console
130+
from rich.markdown import Markdown
131+
132+
Console().print(Markdown(text, justify="left"))
133+
134+
return
135+
except ImportError:
136+
if self.config.colored_output == ColoredOutput.YES:
137+
self.warning('Package "rich" is required to use colored output.')
138+
139+
click.echo(text)
140+
116141

117142
pass_application = click.make_pass_decorator(Application, ensure=True)

0 commit comments

Comments
 (0)