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

Function add_examples

awscli/customizations/addexamples.py:49–78  ·  view source on GitHub ↗
(help_command, **kwargs)

Source from the content-addressed store, hash-verified

47
48
49def add_examples(help_command, **kwargs):
50 doc_path = os.path.join(
51 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'examples'
52 )
53 doc_path = os.path.join(
54 doc_path, help_command.event_class.replace('.', os.path.sep)
55 )
56 doc_path = doc_path + '.rst'
57 LOG.debug("Looking for example file at: %s", doc_path)
58 if os.path.isfile(doc_path):
59 help_command.doc.style.h2('Examples')
60 help_command.doc.style.start_note()
61 msg = (
62 "<p>To use the following examples, you must have the AWS "
63 "CLI installed and configured. See the "
64 "<a href='https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html'>"
65 "Getting started guide</a> in the <i>AWS CLI User Guide</i> "
66 "for more information.</p>"
67 "<p>Unless otherwise stated, all examples have unix-like "
68 "quotation rules. These examples will need to be adapted "
69 "to your terminal's quoting rules. See "
70 "<a href='https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html'>"
71 "Using quotation marks with strings</a> "
72 "in the <i>AWS CLI User Guide</i>.</p>"
73 )
74 help_command.doc.include_doc_string(msg)
75 help_command.doc.style.end_note()
76 fp = open(doc_path)
77 for line in fp.readlines():
78 help_command.doc.write(line)

Callers

nothing calls this directly

Calls 5

h2Method · 0.45
start_noteMethod · 0.45
include_doc_stringMethod · 0.45
end_noteMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected