/
doc_guide.ex
70 lines (64 loc) · 2.34 KB
/
doc_guide.ex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
## This Source Code Form is subject to the terms of the Mozilla Public
## License, v. 2.0. If a copy of the MPL was not distributed with this
## file, You can obtain one at https://mozilla.org/MPL/2.0/.
##
## Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
defmodule RabbitMQ.CLI.Core.DocGuide.Macros do
@moduledoc """
Helper module that works around a compiler limitation: macros cannot
be used in a module that defines them.
"""
@default_domain "rabbitmq.com"
defmacro defguide(name, opts \\ []) do
domain = Keyword.get(opts, :domain, @default_domain)
fn_name = String.to_atom(name)
path_segment = Keyword.get(opts, :path_segment, String.replace(name, "_", "-"))
quote do
def unquote(fn_name)() do
unquote("https://#{domain}/docs/#{path_segment}/")
end
end
end
end
defmodule RabbitMQ.CLI.Core.DocGuide do
require RabbitMQ.CLI.Core.DocGuide.Macros
alias RabbitMQ.CLI.Core.DocGuide.Macros
#
# API
#
Macros.defguide("access_control")
Macros.defguide("alarms")
Macros.defguide("disk_alarms")
Macros.defguide("alternate_exchange", path_segment: "ae")
Macros.defguide("channels")
Macros.defguide("cli")
Macros.defguide("clustering")
Macros.defguide("cluster_formation")
Macros.defguide("connections")
Macros.defguide("configuration", path_segment: "configure")
Macros.defguide("consumers")
Macros.defguide("definitions")
Macros.defguide("erlang_versions", path_segment: "which-erlang")
Macros.defguide("feature_flags")
Macros.defguide("firehose")
Macros.defguide("mirroring", path_segment: "ha")
Macros.defguide("logging")
Macros.defguide("management")
Macros.defguide("memory_use")
Macros.defguide("monitoring")
Macros.defguide("networking")
Macros.defguide("parameters")
Macros.defguide("passwords")
Macros.defguide("plugins")
Macros.defguide("prometheus")
Macros.defguide("publishers")
Macros.defguide("queues")
Macros.defguide("quorum_queues")
Macros.defguide("stream_plugin", path_segment: "stream")
Macros.defguide("streams")
Macros.defguide("runtime_tuning", path_segment: "runtime")
Macros.defguide("tls", path_segment: "ssl")
Macros.defguide("troubleshooting")
Macros.defguide("virtual_hosts", path_segment: "vhosts")
Macros.defguide("upgrade")
end