Skip to content
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

Merged
merged 5 commits into from
Sep 24, 2016

Conversation

ottolin
Copy link
Contributor

@ottolin ottolin commented Sep 23, 2016

hex.docs open will go online to hexdocs.pm
unless --offline option is specified.

fix #291

hex.docs open will go online to hexdocs.pm
unless --offline option is specified.
Copy link
Member

@ericmj ericmj left a 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
Copy link
Member

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.

Copy link
Contributor Author

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary pipeline.

@ottolin ottolin force-pushed the hex.docs_open_offline branch from 9d4b5fe to b73ccdc Compare September 23, 2016 10:52
@@ -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
Copy link
Contributor

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.

@whatyouhide
Copy link
Contributor

Great job @ottolin! 💟

Copy link
Member

@ericmj ericmj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ericmj ericmj merged commit fee5c1a into hexpm:master Sep 24, 2016
@ottolin ottolin deleted the hex.docs_open_offline branch September 26, 2016 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'mix hex.docs open' should go online to hexdocs.pm by default
4 participants