@@ -34,32 +34,8 @@ defmodule IEx.Options do
34
34
"""
35
35
36
36
@ supported_options [
37
- colors: [
38
- doc: """
39
- This is an aggregate option that encapsulates all color settings used
40
- by the shell.
41
-
42
- * enabled -- boolean value that allows for switching the coloring
43
- on and off
44
-
45
- * eval_result -- color for an expression's resulting value
46
- * error -- color for error messages
47
- * info -- color for various informational messages
48
- * directory -- color for directory entries (ls helper)
49
- * device -- color for device entries (ls helper)
50
-
51
- """
52
- ] ,
53
- inspect: [
54
- doc: """
55
- Control the behavior of the shell's inspecting algorithm. Inspect is
56
- used for printing results of evaluating expressions. It is also used by
57
- IO.inspect.
58
-
59
- See the doc for `Kernel.inspect/2` for the full list of options.
60
-
61
- """
62
- ] ,
37
+ colors: [ ] ,
38
+ inspect: [ ] ,
63
39
]
64
40
65
41
@ doc """
@@ -145,7 +121,15 @@ defmodule IEx.Options do
145
121
"""
146
122
def help ( name ) do
147
123
case @ supported_options [ name ] do
148
- kv when is_list ( kv ) -> kv [ :doc ]
124
+ kv when is_list ( kv ) ->
125
+ docs = __MODULE__ . __info__ ( :docs )
126
+ { { _ , _ } , _ , _ , _ , doc } = Enum . find docs , fn { { f , _ } , _ , _ , _ , _ } ->
127
+ f == name
128
+ end
129
+
130
+ # Strip the first paragraph
131
+ String . lstrip ( Regex . replace % r / \A. + ?^ $/ ms , doc , "" )
132
+
149
133
nil -> raise_option ( name )
150
134
end
151
135
end
@@ -164,6 +148,40 @@ defmodule IEx.Options do
164
148
Enum . map @ supported_options , fn { k , _ } -> k end
165
149
end
166
150
151
+ @ doc """
152
+ **NOTE**: This is just a stub for documentation purposes. Use
153
+ `IEx.Options.get` and `IEx.Options.set` to query and change the option's
154
+ value.
155
+
156
+ This is an aggregate option that encapsulates all color settings used
157
+ by the shell.
158
+
159
+ * enabled -- boolean value that allows for switching the coloring
160
+ on and off
161
+
162
+ * eval_result -- color for an expression's resulting value
163
+ * error -- color for error messages
164
+ * info -- color for various informational messages
165
+ * directory -- color for directory entries (ls helper)
166
+ * device -- color for device entries (ls helper)
167
+
168
+ """
169
+ def colors
170
+
171
+ @ doc """
172
+ **NOTE**: This is just a stub for documentation purposes. Use
173
+ `IEx.Options.get` and `IEx.Options.set` to query and change the option's
174
+ value.
175
+
176
+ Control the behavior of the shell's inspecting algorithm. Inspect is
177
+ used for printing results of expression evaluation. It is also used by
178
+ IO.inspect.
179
+
180
+ See the doc for `Kernel.inspect/2` for the full list of options.
181
+
182
+ """
183
+ def inspect
184
+
167
185
defp raise_option ( name ) do
168
186
raise ArgumentError , message: "Unknown IEx option #{ inspect name } "
169
187
end
0 commit comments