Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/awscli/bcdoc/docevents.py
1566 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-breadcrumbs': '.%s',
17
'doc-title': '.%s',
18
'doc-description': '.%s',
19
'doc-synopsis-start': '.%s',
20
'doc-synopsis-option': '.%s.%s',
21
'doc-synopsis-end': '.%s',
22
'doc-options-start': '.%s',
23
'doc-option': '.%s.%s',
24
'doc-option-example': '.%s.%s',
25
'doc-options-end': '.%s',
26
'doc-global-option': '.%s',
27
'doc-examples': '.%s',
28
'doc-output': '.%s',
29
'doc-subitems-start': '.%s',
30
'doc-subitem': '.%s.%s',
31
'doc-subitems-end': '.%s',
32
'doc-relateditems-start': '.%s',
33
'doc-relateditem': '.%s.%s',
34
'doc-relateditems-end': '.%s'
35
}
36
37
38
def generate_events(session, help_command):
39
# Now generate the documentation events
40
session.emit('doc-breadcrumbs.%s' % help_command.event_class,
41
help_command=help_command)
42
session.emit('doc-title.%s' % help_command.event_class,
43
help_command=help_command)
44
session.emit('doc-description.%s' % help_command.event_class,
45
help_command=help_command)
46
session.emit('doc-synopsis-start.%s' % help_command.event_class,
47
help_command=help_command)
48
if help_command.arg_table:
49
for arg_name in help_command.arg_table:
50
# An argument can set an '_UNDOCUMENTED' attribute
51
# to True to indicate a parameter that exists
52
# but shouldn't be documented. This can be used
53
# for backwards compatibility of deprecated arguments.
54
if getattr(help_command.arg_table[arg_name],
55
'_UNDOCUMENTED', False):
56
continue
57
session.emit(
58
'doc-synopsis-option.%s.%s' % (help_command.event_class,
59
arg_name),
60
arg_name=arg_name, help_command=help_command)
61
session.emit('doc-synopsis-end.%s' % help_command.event_class,
62
help_command=help_command)
63
session.emit('doc-options-start.%s' % help_command.event_class,
64
help_command=help_command)
65
if help_command.arg_table:
66
for arg_name in help_command.arg_table:
67
if getattr(help_command.arg_table[arg_name],
68
'_UNDOCUMENTED', False):
69
continue
70
session.emit('doc-option.%s.%s' % (help_command.event_class,
71
arg_name),
72
arg_name=arg_name, help_command=help_command)
73
session.emit('doc-option-example.%s.%s' %
74
(help_command.event_class, arg_name),
75
arg_name=arg_name, help_command=help_command)
76
session.emit('doc-options-end.%s' % help_command.event_class,
77
help_command=help_command)
78
session.emit('doc-global-option.%s' % help_command.event_class,
79
help_command=help_command)
80
session.emit('doc-subitems-start.%s' % help_command.event_class,
81
help_command=help_command)
82
if help_command.command_table:
83
for command_name in sorted(help_command.command_table.keys()):
84
if hasattr(help_command.command_table[command_name],
85
'_UNDOCUMENTED'):
86
continue
87
session.emit('doc-subitem.%s.%s'
88
% (help_command.event_class, command_name),
89
command_name=command_name,
90
help_command=help_command)
91
session.emit('doc-subitems-end.%s' % help_command.event_class,
92
help_command=help_command)
93
session.emit('doc-examples.%s' % help_command.event_class,
94
help_command=help_command)
95
session.emit('doc-output.%s' % help_command.event_class,
96
help_command=help_command)
97
session.emit('doc-relateditems-start.%s' % help_command.event_class,
98
help_command=help_command)
99
if help_command.related_items:
100
for related_item in sorted(help_command.related_items):
101
session.emit('doc-relateditem.%s.%s'
102
% (help_command.event_class, related_item),
103
help_command=help_command,
104
related_item=related_item)
105
session.emit('doc-relateditems-end.%s' % help_command.event_class,
106
help_command=help_command)
107
108