|
1 | 1 | ---
|
2 |
| -title: 'Creating a New Component Type' |
| 2 | +title: 'Creating a new component type' |
3 | 3 | sidebar_position: 100
|
4 | 4 | ---
|
5 | 5 |
|
@@ -36,13 +36,11 @@ For this example, we'll write a lightweight component that executes a shell comm
|
36 | 36 |
|
37 | 37 | First, we use the `dg` command-line utility to scaffold a new component type:
|
38 | 38 |
|
39 |
| -```bash |
40 |
| -dg component-type generate shell_command |
41 |
| -``` |
| 39 | +<CliInvocationExample path="docs_beta_snippets/docs_beta_snippets/guides/components/shell-script-component/1-dg-scaffold-shell-command.txt" /> |
42 | 40 |
|
43 | 41 | This will add a new file to your project in the `lib` directory:
|
44 | 42 |
|
45 |
| -<CodeExample path="docs_beta_snippets/docs_beta_snippets/guides/components/shell-script-component/empty.py" language="python" /> |
| 43 | +<CodeExample path="docs_beta_snippets/docs_beta_snippets/guides/components/shell-script-component/2-shell-command-empty.py" language="python" title="my_component_library/lib/shell_command.py" /> |
46 | 44 |
|
47 | 45 | This file contains the basic structure for the new component type. There are two methods that you'll need to implement:
|
48 | 46 |
|
@@ -88,18 +86,15 @@ Our `build_defs` method will create a single `@asset` that executes the provided
|
88 | 86 |
|
89 | 87 | Following the steps above will automatically register your component type in your environment. You can now run:
|
90 | 88 |
|
91 |
| -```bash |
92 |
| -dg component-type list |
93 |
| -``` |
| 89 | +<CliInvocationExample path="docs_beta_snippets/docs_beta_snippets/guides/components/shell-script-component/3-dg-list-component-types.txt" /> |
94 | 90 |
|
95 | 91 | and see your new component type in the list of available component types.
|
96 | 92 |
|
97 | 93 | You can also view automatically generated documentation describing your new component type by running:
|
98 | 94 |
|
99 |
| -```bash |
100 |
| -dg component-type docs your_library.shell_command |
101 |
| -``` |
| 95 | +<CliInvocationExample path="docs_beta_snippets/docs_beta_snippets/guides/components/shell-script-component/4-dg-component-type-docs.txt" /> |
102 | 96 |
|
| 97 | + |
103 | 98 | ## [Advanced] Custom templating
|
104 | 99 |
|
105 | 100 | The components system supports a rich templating syntax that allows you to load arbitrary Python values based off of your `component.yaml` file.
|
@@ -140,4 +135,4 @@ params:
|
140 | 135 |
|
141 | 136 | ## Next steps
|
142 | 137 |
|
143 |
| -- Add a new component to your project |
| 138 | +- [Add a new component to your project](./using-a-component.md) |
0 commit comments