File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,11 @@ Options:
67
67
- ` --name ` : Overwrite the project name when naming the docset.
68
68
The name defaults to the project name, or for umbrella apps,
69
69
the name of the directory.
70
+ - ` --abbr ` : Overwrite the abbreviation for searching the docs.
71
+ Defaults to the first two characters of the project name.
72
+ Note that changing the abbreviation of the app requires
73
+ deleting the docset entirely from Dash (via the preferneces pane)
74
+ and likely running ` mix docs.dash --open ` to force the docset to re-index.
70
75
71
76
# Hacking ExDocs into Dash Docs
72
77
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ defmodule ExDash.Docset do
120
120
<dict>
121
121
<key>CFBundleIdentifier</key> <string>{{CONFIG_PROJECT}}-{{CONFIG_VERSION}}</string>
122
122
<key>CFBundleName</key> <string>{{CONFIG_PROJECT}} {{CONFIG_VERSION}}</string>
123
- <key>DocSetPlatformFamily</key> <string>{{CONFIG_PROJECT }}</string>
123
+ <key>DocSetPlatformFamily</key> <string>{{CONFIG_PROJECT_ABBREV }}</string>
124
124
<key>isDashDocset</key> <true/>
125
125
<key>isJavaScriptEnabled</key> <true/>
126
126
<key>dashIndexFilePath</key> <string>index.html</string>
@@ -138,9 +138,19 @@ defmodule ExDash.Docset do
138
138
version
139
139
end
140
140
141
+ abbreviation =
142
+ case Store . get ( :abbreviation ) do
143
+ nil ->
144
+ name |> String . slice ( 0 , 2 )
145
+
146
+ abbr ->
147
+ abbr
148
+ end
149
+
141
150
@ info_plist_template
142
151
|> String . replace ( "{{CONFIG_PROJECT}}" , name )
143
152
|> String . replace ( "{{CONFIG_VERSION}}" , version )
153
+ |> String . replace ( "{{CONFIG_PROJECT_ABBREV}}" , abbreviation )
144
154
end
145
155
146
156
end
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ defmodule Mix.Tasks.Docs.Dash do
19
19
Defaults to true unless the docset exists in the `/doc` dir before the run.
20
20
* `--name NAME`: names the docset something other than the app name.
21
21
Defaults to the project name, or (if an umbrella app) the `cwd` of the mix task
22
+ * `--abbr ABBREVIATION`: the default abbreviation to search for your docs with.
23
+ Default: first two characters of the project name. (i.e. `ex` for `ex_dash`).
22
24
23
25
"""
24
26
@ spec run ( args ) :: String . t
@@ -29,9 +31,13 @@ defmodule Mix.Tasks.Docs.Dash do
29
31
name =
30
32
Keyword . get ( opts , :name )
31
33
34
+ abbr =
35
+ Keyword . get ( opts , :abbr )
36
+
32
37
Store . start_link ( )
33
38
34
39
Store . set ( :name , name )
40
+ Store . set ( :abbreviation , abbr )
35
41
36
42
[ doc_set_path ] =
37
43
Docs . run ( [ "-f" , ExDash ] )
You can’t perform that action at this time.
0 commit comments