12
12
from dagster_dg .component_key import GlobalComponentKey
13
13
from dagster_dg .config import normalize_cli_config
14
14
from dagster_dg .context import DgContext
15
- from dagster_dg .docs import markdown_for_component_type , render_markdown_in_browser
15
+ from dagster_dg .docs import html_from_markdown , markdown_for_component_type , open_html_in_browser
16
16
from dagster_dg .scaffold import scaffold_component_type
17
17
from dagster_dg .utils import DgClickCommand , DgClickGroup , exit_with_error
18
18
@@ -56,11 +56,13 @@ def component_type_scaffold_command(
56
56
57
57
@component_type_group .command (name = "docs" , cls = DgClickCommand )
58
58
@click .argument ("component_type" , type = str )
59
+ @click .option ("--output" , type = click .Choice (["browser" , "cli" ]), default = "browser" )
59
60
@dg_global_options
60
61
@click .pass_context
61
62
def component_type_docs_command (
62
63
context : click .Context ,
63
64
component_type : str ,
65
+ output : str ,
64
66
** global_options : object ,
65
67
) -> None :
66
68
"""Get detailed information on a registered Dagster component type."""
@@ -71,7 +73,11 @@ def component_type_docs_command(
71
73
if not registry .has_global (component_key ):
72
74
exit_with_error (f"Component type`{ component_type } ` not found." )
73
75
74
- render_markdown_in_browser (markdown_for_component_type (registry .get_global (component_key )))
76
+ markdown = markdown_for_component_type (registry .get_global (component_key ))
77
+ if output == "browser" :
78
+ open_html_in_browser (html_from_markdown (markdown ))
79
+ else :
80
+ click .echo (html_from_markdown (markdown ))
75
81
76
82
77
83
# ########################
0 commit comments