Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/awscli/bcdoc/docevents.py
2630 views
1
# Copyright 2012-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License"). You
4
# may not use this file except in compliance with the License. A copy of
5
# the License is located at
6
#
7
# http://aws.amazon.com/apache2.0/
8
#
9
# or in the "license" file accompanying this file. This file is
10
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
# ANY KIND, either express or implied. See the License for the specific
12
# language governing permissions and limitations under the License.
13
14
15
DOC_EVENTS = {
16
'doc-meta-description': '.%s',
17
'doc-breadcrumbs': '.%s',
18
'doc-title': '.%s',
19
'doc-description': '.%s',
20
'doc-synopsis-start': '.%s',
21
'doc-synopsis-option': '.%s.%s',
22
'doc-synopsis-end': '.%s',
23
'doc-options-start': '.%s',
24
'doc-option': '.%s.%s',
25
'doc-option-example': '.%s.%s',
26
'doc-options-end': '.%s',
27
'doc-global-option': '.%s',
28
'doc-examples': '.%s',
29
'doc-output': '.%s',
30
'doc-subitems-start': '.%s',
31
'doc-subitem': '.%s.%s',
32
'doc-subitems-end': '.%s',
33
'doc-relateditems-start': '.%s',
34
'doc-relateditem': '.%s.%s',
35
'doc-relateditems-end': '.%s'
36
}
37
38
39
def generate_events(session, help_command):
40
# Now generate the documentation events
41
session.emit('doc-breadcrumbs.%s' % help_command.event_class,
42
help_command=help_command)
43
session.emit('doc-meta-description.%s' % help_command.event_class,
44
help_command=help_command)
45
session.emit('doc-title.%s' % help_command.event_class,
46
help_command=help_command)
47
session.emit('doc-description.%s' % help_command.event_class,
48
help_command=help_command)
49
session.emit('doc-synopsis-start.%s' % help_command.event_class,
50
help_command=help_command)
51
if help_command.arg_table:
52
for arg_name in help_command.arg_table:
53
# An argument can set an '_UNDOCUMENTED' attribute
54
# to True to indicate a parameter that exists
55
# but shouldn't be documented. This can be used
56
# for backwards compatibility of deprecated arguments.
57
if getattr(help_command.arg_table[arg_name],
58
'_UNDOCUMENTED', False):
59
continue
60
session.emit(
61
'doc-synopsis-option.%s.%s' % (help_command.event_class,
62
arg_name),
63
arg_name=arg_name, help_command=help_command)
64
session.emit('doc-synopsis-end.%s' % help_command.event_class,
65
help_command=help_command)
66
session.emit('doc-options-start.%s' % help_command.event_class,
67
help_command=help_command)
68
if help_command.arg_table:
69
for arg_name in help_command.arg_table:
70
if getattr(help_command.arg_table[arg_name],
71
'_UNDOCUMENTED', False):
72
continue
73
session.emit('doc-option.%s.%s' % (help_command.event_class,
74
arg_name),
75
arg_name=arg_name, help_command=help_command)
76
session.emit('doc-option-example.%s.%s' %
77
(help_command.event_class, arg_name),
78
arg_name=arg_name, help_command=help_command)
79
session.emit('doc-options-end.%s' % help_command.event_class,
80
help_command=help_command)
81
session.emit('doc-global-option.%s' % help_command.event_class,
82
help_command=help_command)
83
session.emit('doc-subitems-start.%s' % help_command.event_class,
84
help_command=help_command)
85
if help_command.command_table:
86
for command_name in sorted(help_command.command_table.keys()):
87
if hasattr(help_command.command_table[command_name],
88
'_UNDOCUMENTED'):
89
continue
90
session.emit('doc-subitem.%s.%s'
91
% (help_command.event_class, command_name),
92
command_name=command_name,
93
help_command=help_command)
94
session.emit('doc-subitems-end.%s' % help_command.event_class,
95
help_command=help_command)
96
session.emit('doc-examples.%s' % help_command.event_class,
97
help_command=help_command)
98
session.emit('doc-output.%s' % help_command.event_class,
99
help_command=help_command)
100
session.emit('doc-relateditems-start.%s' % help_command.event_class,
101
help_command=help_command)
102
if help_command.related_items:
103
for related_item in sorted(help_command.related_items):
104
session.emit('doc-relateditem.%s.%s'
105
% (help_command.event_class, related_item),
106
help_command=help_command,
107
related_item=related_item)
108
session.emit('doc-relateditems-end.%s' % help_command.event_class,
109
help_command=help_command)
110
111