Skip to content

Commit eb62d7b

Browse files
eksperimentaljosevalim
authored andcommitted
Sort arguments and options alphabetically (#689)
1 parent 96223c2 commit eb62d7b

File tree

2 files changed

+60
-58
lines changed

2 files changed

+60
-58
lines changed

lib/ex_doc/cli.ex

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ defmodule ExDoc.CLI do
1111
{opts, args, _invalid} =
1212
OptionParser.parse(args,
1313
aliases: [
14+
a: :assets,
15+
n: :canonical,
1416
c: :config,
15-
o: :output,
16-
f: :formatter,
17-
i: :filter_prefix,
18-
r: :source_root,
19-
u: :source_url,
20-
m: :main,
21-
p: :homepage_url,
2217
e: :extra,
2318
s: :extra_section,
24-
a: :assets,
19+
i: :filter_prefix,
20+
f: :formatter,
21+
p: :homepage_url,
2522
l: :logo,
26-
n: :canonical,
23+
m: :main,
24+
o: :output,
25+
r: :source_root,
26+
u: :source_url,
2727
v: :version,
2828
],
2929

@@ -118,25 +118,25 @@ defmodule ExDoc.CLI do
118118
PROJECT Project name
119119
VERSION Version number
120120
BEAMS Path to compiled beam files
121+
-a, --assets Path to a directory that will be copied as is to the "assets"
122+
directory in the output path
123+
-n, --canonical Indicate the preferred URL with rel="canonical" link element
121124
-c, --config Give configuration through a file instead of command line
122-
-o, --output Path to output docs, default: "doc"
123-
-f, --formatter Docs formatter to use (html or epub), default: "html"
124-
-i, --filter-prefix Include only modules that match the given prefix in
125-
the generated documentation.
126-
-r, --source-root Path to the source code root, default: "."
127-
-u, --source-url URL to the source code
128-
--source-ref Branch/commit/tag used for source link inference, default: "master"
129-
-m, --main The entry-point page in docs, default: "api-reference"
130-
-p, --homepage-url URL to link to for the site name
131125
-e, --extra Allow users to include additional Markdown files
132126
May be given multiple times
133127
-s, --extra-section Allow user to define the title for the additional Markdown files,
134128
default: "PAGES"
135-
-a, --assets Path to a directory that will be copied as is to the "assets"
136-
directory in the output path
129+
-i, --filter-prefix Include only modules that match the given prefix in
130+
the generated documentation.
131+
-f, --formatter Docs formatter to use (html or epub), default: "html"
132+
-p, --homepage-url URL to link to for the site name
137133
-l, --logo Path to the image logo of the project (only PNG or JPEG accepted)
138134
The image size will be 64x64 and copied to the assets directory
139-
-n, --canonical Indicate the preferred URL with rel="canonical" link element
135+
-m, --main The entry-point page in docs, default: "api-reference"
136+
--source-ref Branch/commit/tag used for source link inference, default: "master"
137+
-r, --source-root Path to the source code root, default: "."
138+
-u, --source-url URL to the source code
139+
-o, --output Path to output docs, default: "doc"
140140
-v, --version Print ExDoc version
141141
142142
## Source linking

lib/mix/tasks/docs.ex

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ defmodule Mix.Tasks.Docs do
88
99
## Command line options
1010
11-
* `--output`, `-o` - Output directory for the generated
12-
docs, default: `"doc"`
13-
* `--formatter`, `-f` - Which formatters to use, "html" or
14-
"epub", default: "html" (may be given more than once)
1511
* `--canonical`, `-n` - Indicate the preferred URL with
1612
rel="canonical" link element, defaults to no canonical path
1713
14+
* `--formatter`, `-f` - Which formatters to use, "html" or
15+
"epub", default: "html" (may be given more than once)
16+
17+
* `--output`, `-o` - Output directory for the generated
18+
docs, default: `"doc"`
19+
1820
The command line options have higher precedence than the options
1921
specified in your `mix.exs` file below.
2022
@@ -45,53 +47,53 @@ defmodule Mix.Tasks.Docs do
4547
be a keyword list or a function returning a keyword list that will
4648
be lazily executed.
4749
48-
* `:output` - Output directory for the generated docs; default: "doc".
49-
May be overridden by command line argument.
50-
51-
* `:formatters` - Formatter to use; default: ["html"],
52-
options: "html", "epub".
50+
* `:assets` - Path to a directory that will be copied as is to the "assets"
51+
directory in the output path. Its entries may be referenced in your docs
52+
under "assets/ASSET.EXTENSION"; defaults to no assets directory.
5353
54-
* `:source_root` - Path to the source code root directory;
55-
default: "." (current directory).
54+
* `:canonical` - String that defines the preferred URL with the rel="canonical"
55+
element; defaults to no canonical path.
5656
57-
* `:source_beam` - Path to the beam directory; default: mix's compile path.
57+
* `:deps` - A keyword list application names and their documentation URL.
58+
ExDoc will by default include all dependencies and assume they are hosted on
59+
HexDocs. This can be overridden by your own values. Example: `[plug: "https://myserver/plug/"]`
5860
59-
* `:source_ref` - The branch/commit/tag used for source link inference;
60-
default: "master".
61+
* `:extra_section` - String that defines the section title of the additional
62+
Markdown pages; default: "PAGES". Example: "GUIDES"
6163
62-
* `:source_url_pattern` - Public URL of the project. Derived from
63-
project's `:source_url` and `:source_ref`. Example:
64-
"https://github.com/USER/APP/blob/master/%{path}#L%{line}"
64+
* `:extras` - List of keywords, each key must indicate the path to additional
65+
Markdown pages, the value for each keyword (optional) gives you more control
66+
about the PATH and the title of the output files; default: `[]`. Example:
67+
`["README.md", "CONTRIBUTING.md": [filename: "contributing", title: "Contributing", group: "Join us!"]]`
6568
66-
* `:main` - Main page of the documentation. It may be a module or a
67-
generated page, like "Plug" or "api-reference"; default: "api-reference".
69+
* `:filter_prefix` - Include only modules that match the given prefix in
70+
the generated documentation. Example: "MyApp.Core"
6871
69-
* `:assets` - Path to a directory that will be copied as is to the "assets"
70-
directory in the output path. Its entries may be referenced in your docs
71-
under "assets/ASSET.EXTENSION"; defaults to no assets directory.
72+
* `:formatters` - Formatter to use; default: ["html"],
73+
options: "html", "epub".
7274
7375
* `:logo` - Path to the image logo of the project (only PNG or JPEG accepted)
7476
The image size will be 64x64. When specified, the logo will be placed under
7577
the "assets" directory in the output path under the name "logo" and the
7678
appropriate extension.
7779
78-
* `:extras` - List of keywords, each key must indicate the path to additional
79-
Markdown pages, the value for each keyword (optional) gives you more control
80-
about the PATH and the title of the output files; default: `[]`. Example:
81-
`["README.md", "CONTRIBUTING.md": [filename: "contributing", title: "Contributing", group: "Join us!"]]`
80+
* `:main` - Main page of the documentation. It may be a module or a
81+
generated page, like "Plug" or "api-reference"; default: "api-reference".
8282
83-
* `:extra_section` - String that defines the section title of the additional
84-
Markdown pages; default: "PAGES". Example: "GUIDES"
83+
* `:source_beam` - Path to the beam directory; default: mix's compile path.
8584
86-
* `:deps` - A keyword list application names and their documentation URL.
87-
ExDoc will by default include all dependencies and assume they are hosted on
88-
HexDocs. This can be overridden by your own values. Example: `[plug: "https://myserver/plug/"]`
85+
* `:source_ref` - The branch/commit/tag used for source link inference;
86+
default: "master".
8987
90-
* `:canonical` - String that defines the preferred URL with the rel="canonical"
91-
element; defaults to no canonical path.
88+
* `:source_root` - Path to the source code root directory;
89+
default: "." (current directory).
9290
93-
* `:filter_prefix` - Include only modules that match the given prefix in
94-
the generated documentation. Example: "MyApp.Core"
91+
* `:source_url_pattern` - Public URL of the project. Derived from
92+
project's `:source_url` and `:source_ref`. Example:
93+
"https://github.com/USER/APP/blob/master/%{path}#L%{line}"
94+
95+
* `:output` - Output directory for the generated docs; default: "doc".
96+
May be overridden by command line argument.
9597
9698
## Umbrella project
9799
@@ -109,8 +111,8 @@ defmodule Mix.Tasks.Docs do
109111
Mix.Task.run "compile"
110112

111113
{cli_opts, args, _} = OptionParser.parse(args,
112-
aliases: [o: :output, n: :canonical, f: :formatter],
113-
switches: [output: :string, canonical: :string, formatter: :keep])
114+
aliases: [n: :canonical, f: :formatter, o: :output],
115+
switches: [canonical: :string, formatter: :keep, output: :string])
114116

115117
if args != [] do
116118
Mix.raise "Extraneous arguments on the command line"

0 commit comments

Comments
 (0)