module documentation
Main functions to be called by the UI Application classes, after CLI option parsing.
| Function | dump |
Pretty-print the data as fmt, with color if interactive, to stdout. |
| Function | dump |
Read NestedText from stdin or input_files, and send an up-typed data format to stdout. |
| Function | dump |
Read typed data from stdin or input_files, and send NestedText to stdout. |
| Function | dump |
Read typed data from stdin or input_files, and send a NestedText schema to stdout. |
| Constant | RICH |
Undocumented |
| Function | _ansi |
Return True if it's acceptable to use ANSI escape sequences. |
| Function | _dump |
Pretty-print the data as NestedText, with color if interactive, to stdout. |
| Function | _dump |
Undocumented |
| Function | _syntax |
Print a syntax-highlighted rendering of the content to terminal. |
def dump_format(*, data:
TypedData, fmt: str, dump_stdout: Callable[ [ TypedData], None], dump_str: Callable[ [ TypedData], str], **kwargs: Any):
(source)
¶
Pretty-print the data as fmt, with color if interactive, to stdout.
| Parameters | |
data:TypedData | TypedData to dump as the format. |
fmt:str | The format to dump as (e.g. 'json'). |
dumpCallable[ | A function to dump the data to stdout, plainly. |
dumpCallable[ | A function to dump the data to a string, also plain, for potential colorizing. |
**kwargs:Any | Keyword arguments to pass to the format's dump_str or dump_stdout. |
def dump_from_nestedtext(*, input_files:
LocalPath, dump_stdout: Callable[ [ TypedData], None], dump_str: Callable[ [ TypedData], str], fmt: str, converter: Converter, fix_data: Callable[ [ TypedData], TypedData] | None = None, bool_paths: Sequence[ str] = (), null_paths: Sequence[ str] = (), num_paths: Sequence[ str] = (), date_paths: Sequence[ str] = ()):
(source)
¶
Read NestedText from stdin or input_files, and send an up-typed data format to stdout.
| Parameters | |
inputLocalPath | LocalPaths with NestedText content. |
dumpCallable[ | A function to dump the data to stdout, plainly. |
dumpCallable[ | A function to dump the data to a string, also plain, for potential colorizing. |
fmt:str | The format to use for dumping (e.g., 'toml'). |
converter:Converter | A Converter used to unstructure the result to match specific type support. |
fixCallable[ | A function to fix the data, post-uptyping, if necessary. |
boolSequence[ | YAMLPath queries whose matches will be up-typed to bool. |
nullSequence[ | YAMLPath queries whose matches will be up-typed to None. |
numSequence[ | YAMLPath queries whose matches will be up-typed to int/float. |
dateSequence[ | YAMLPath queries whose matches will be up-typed to date/datetime/time. |
def dump_to_nestedtext(*, load_stdin:
Callable[ [], TypedData], load_file: Callable[ [ LocalPath], TypedData], input_files: Sequence[ LocalPath], inline_width: int = 0):
(source)
¶
Read typed data from stdin or input_files, and send NestedText to stdout.
Colorize if stdout is a terminal.
| Parameters | |
loadCallable[ | A function to load typed data from stdin. |
loadCallable[ | A function to load typed data from a LocalPath. |
inputSequence[ | LocalPaths with typed data content. |
inlineint | Maximum line length for inline dictionaries and lists. |
def dump_to_schema(*, load_stdin:
Callable[ [], TypedData], load_file: Callable[ [ LocalPath], TypedData], input_files: Sequence[ LocalPath]):
(source)
¶
Read typed data from stdin or input_files, and send a NestedText schema to stdout.
| Parameters | |
loadCallable[ | A function to load typed data from stdin. |
loadCallable[ | A function to load typed data from a LocalPath. |
inputSequence[ | LocalPaths with typed data content. |
Return True if it's acceptable to use ANSI escape sequences.
| Returns | |
bool | True if stdout is a terminal OR FORCE_COLOR is set. |
Pretty-print the data as NestedText, with color if interactive, to stdout.
| Parameters | |
data:TypedData | An object, usually dict or list, to dump as NestedText. |
inlineint | Maximum line length for inline dictionaries and lists. |