MCPcopy Index your code
hub / github.com/aws/aws-sam-cli / format_examples

Method format_examples

samcli/commands/init/core/command.py:22–81  ·  view source on GitHub ↗
(ctx: Context, formatter: CommandHelpTextFormatter)

Source from the content-addressed store, hash-verified

20
21 @staticmethod
22 def format_examples(ctx: Context, formatter: CommandHelpTextFormatter):
23 with formatter.indented_section(name="Examples", extra_indents=1):
24 with formatter.indented_section(name="Interactive Mode", extra_indents=1):
25 formatter.write_text_rows(
26 [
27 RowDefinition(name=style(f"$ {ctx.command_path}"), extra_row_modifiers=[ShowcaseRowModifier()]),
28 ]
29 )
30 with formatter.indented_section(name="Customized Interactive Mode", extra_indents=1):
31 formatter.write_text_rows(
32 [
33 RowDefinition(
34 name=style(
35 f"$ {ctx.command_path} --name sam-app --runtime nodejs18.x --architecture arm64"
36 ),
37 extra_row_modifiers=[ShowcaseRowModifier()],
38 ),
39 RowDefinition(
40 name=style(
41 f"$ {ctx.command_path} --name sam-app --runtime nodejs18.x --dependency-manager "
42 f"npm --app-template hello-world"
43 ),
44 extra_row_modifiers=[ShowcaseRowModifier()],
45 ),
46 RowDefinition(
47 name=style(
48 f"$ {ctx.command_path} --name sam-app --package-type image --architecture arm64"
49 ),
50 extra_row_modifiers=[ShowcaseRowModifier()],
51 ),
52 ]
53 )
54 with formatter.indented_section(name="Direct Initialization", extra_indents=1):
55 formatter.write_text_rows(
56 [
57 RowDefinition(
58 name=style(f"$ {ctx.command_path} --location gh:aws-samples/cookiecutter-aws-sam-python"),
59 extra_row_modifiers=[ShowcaseRowModifier()],
60 ),
61 RowDefinition(
62 name=style(
63 f"$ {ctx.command_path} --location "
64 f"git+ssh://git@github.com/aws-samples/cookiecutter-aws-sam-python.git"
65 ),
66 extra_row_modifiers=[ShowcaseRowModifier()],
67 ),
68 RowDefinition(
69 name=style(f"$ {ctx.command_path} --location /path/to/template.zip"),
70 extra_row_modifiers=[ShowcaseRowModifier()],
71 ),
72 RowDefinition(
73 name=style(f"$ {ctx.command_path} --location /path/to/template/directory"),
74 extra_row_modifiers=[ShowcaseRowModifier()],
75 ),
76 RowDefinition(
77 name=style(f"$ {ctx.command_path} --location https://example.com/path/to/template.zip"),
78 extra_row_modifiers=[ShowcaseRowModifier()],
79 ),

Callers 1

format_optionsMethod · 0.45

Calls 4

RowDefinitionClass · 0.90
ShowcaseRowModifierClass · 0.90
indented_sectionMethod · 0.45
write_text_rowsMethod · 0.45

Tested by

no test coverage detected