-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding --offline option to hex.docs open #292
Conversation
hex.docs open will go online to hexdocs.pm unless --offline option is specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I only have a comment about the pipelines.
Mix.raise "Documentation file not found: #{path}" | ||
end | ||
|
||
path |> browser_open |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually avoid pipelines if it's just a single pipe like this. browser_open(path)
is clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I'll update it and also add --offline to the unit tests also.
defp open_docs([name], opts) do | ||
defp open_docs(package, opts) do | ||
if opts[:offline] do | ||
package |> open_docs_offline(opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary pipeline.
9d4b5fe
to
b73ccdc
Compare
@@ -96,22 +96,36 @@ defmodule Mix.Tasks.Hex.Docs do | |||
Mix.raise "You must specify at least the name of a package" | |||
end | |||
|
|||
defp open_docs([name], opts) do | |||
defp open_docs(package, opts) do | |||
if opts[:offline] do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add offline: boolean
switch to OptionParser.parse/2
call.
Great job @ottolin! 💟 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
hex.docs open will go online to hexdocs.pm
unless --offline option is specified.
fix #291