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

cargo doc --open does nothing #1472

Closed
ruabmbua opened this Issue Apr 1, 2015 · 9 comments

Comments

Projects
None yet
4 participants
@ruabmbua

ruabmbua commented Apr 1, 2015

The command cargo doc --open should build the docs, and open them in a browser after compilation finished.

The command only builds the docs, but after building is finished no further action takes place(opening doc in browser). The problem exists for me on both windows and arch linux. Both operating systems have firefox configured as their default browser.

@huonw

This comment has been minimized.

Show comment
Hide comment
@huonw

huonw Apr 1, 2015

Member

Do the docs open if you run cargo doc; xdg-open target/doc/CRATENAME/index.html? Also, are you running cargo doc inside a shell or inside some other program? Lastly, what is the name of your package? (Specifically, does it contain a hyphen?)

Member

huonw commented Apr 1, 2015

Do the docs open if you run cargo doc; xdg-open target/doc/CRATENAME/index.html? Also, are you running cargo doc inside a shell or inside some other program? Lastly, what is the name of your package? (Specifically, does it contain a hyphen?)

@ruabmbua

This comment has been minimized.

Show comment
Hide comment
@ruabmbua

ruabmbua Apr 2, 2015

xdg-open works just fine. I am using the kde konsole, in which regular bash is running. Also the full path to my project does only contain [a-zA-Z] characters.

ruabmbua commented Apr 2, 2015

xdg-open works just fine. I am using the kde konsole, in which regular bash is running. Also the full path to my project does only contain [a-zA-Z] characters.

@huonw huonw added the Command-doc label Apr 9, 2015

@Gustorn

This comment has been minimized.

Show comment
Hide comment
@Gustorn

Gustorn Apr 10, 2015

For me cargo doc --open works fine with KDE/Konsole (default browser is Chromium).
Cargo version:

cargo 0.0.1-pre-nightly (471c519 2015-04-08) (built 2015-04-09)

KDE / Konsole:

Qt: 5.4.1
KDE Frameworks: 5.9.0
Konsole: 15.04.0

Gustorn commented Apr 10, 2015

For me cargo doc --open works fine with KDE/Konsole (default browser is Chromium).
Cargo version:

cargo 0.0.1-pre-nightly (471c519 2015-04-08) (built 2015-04-09)

KDE / Konsole:

Qt: 5.4.1
KDE Frameworks: 5.9.0
Konsole: 15.04.0
@ruabmbua

This comment has been minimized.

Show comment
Hide comment
@ruabmbua

ruabmbua Apr 12, 2015

My versions are:

Qt: 5.4.1
KDE Frameworks: 5.8.0
Konsole: 3.0.1

For the date of me making the bug report, these version were very recent. What is about the Konsole version 15.04.0? On my OS (archlinux) Konsole 3.0.1 is the most recent one.

ruabmbua commented Apr 12, 2015

My versions are:

Qt: 5.4.1
KDE Frameworks: 5.8.0
Konsole: 3.0.1

For the date of me making the bug report, these version were very recent. What is about the Konsole version 15.04.0? On my OS (archlinux) Konsole 3.0.1 is the most recent one.

@Gustorn

This comment has been minimized.

Show comment
Hide comment
@Gustorn

Gustorn Apr 12, 2015

I'm using Arch Linux too, with the testing and kde-unstable repos.

Gustorn commented Apr 12, 2015

I'm using Arch Linux too, with the testing and kde-unstable repos.

@ruabmbua

This comment has been minimized.

Show comment
Hide comment
@ruabmbua

ruabmbua Apr 12, 2015

Ah okay. Maybe it will work, when I get access to kde frameworks 5.9.0 and the more recent konsole. I do not want to use testing, but I will come back here and comment again, when I get the update.

ruabmbua commented Apr 12, 2015

Ah okay. Maybe it will work, when I get access to kde frameworks 5.9.0 and the more recent konsole. I do not want to use testing, but I will come back here and comment again, when I get the update.

@mohtar

This comment has been minimized.

Show comment
Hide comment
@mohtar

mohtar Apr 17, 2015

Contributor

This happened to me, and after some digging I think I may have isolated the problem. Although, I'm not sure if my particular case is the same as @ruabmbua's.

If the package has executables only but no lib (i.e. src/lib.rs), then cargo doc --open wouldn't work. A workaround is to specify the package name explicitly: cargo doc --open --package <name>.

There's another separate case: when the package name contains a hyphen in it, then cargo doc --open would also fail (and silently, too). A workaround is to add a [lib] section in the manifest with a different name from the package, and it must not contain a hyphen.

I'm guessing both behaviors are unintended. I believe I know where the culprit lies and I may open a pull request soon... once I devised a viable fix.

Contributor

mohtar commented Apr 17, 2015

This happened to me, and after some digging I think I may have isolated the problem. Although, I'm not sure if my particular case is the same as @ruabmbua's.

If the package has executables only but no lib (i.e. src/lib.rs), then cargo doc --open wouldn't work. A workaround is to specify the package name explicitly: cargo doc --open --package <name>.

There's another separate case: when the package name contains a hyphen in it, then cargo doc --open would also fail (and silently, too). A workaround is to add a [lib] section in the manifest with a different name from the package, and it must not contain a hyphen.

I'm guessing both behaviors are unintended. I believe I know where the culprit lies and I may open a pull request soon... once I devised a viable fix.

@ruabmbua

This comment has been minimized.

Show comment
Hide comment
@ruabmbua

ruabmbua Apr 18, 2015

@mohtar: Yes it seems like I have the same issue(not having a lib.rs in my source tree).

ruabmbua commented Apr 18, 2015

@mohtar: Yes it seems like I have the same issue(not having a lib.rs in my source tree).

@mohtar

This comment has been minimized.

Show comment
Hide comment
@mohtar

mohtar Apr 18, 2015

Contributor

Well that confirms my suspicions then!

Contributor

mohtar commented Apr 18, 2015

Well that confirms my suspicions then!

bors added a commit that referenced this issue Apr 18, 2015

Auto merge of #1533 - mohtar:doc-open, r=wycats
Since #318, the `doc` command generates documentation for binaries in addition to libraries. But currently running `cargo doc --open` would not launch the browser for binary-only packages, even though it should. This commit changes the logic: binaries will be searched when there are no libraries in the package.

A simple test case:

`Cargo.toml`:

    [package]
    name = "foo"
    version = "0.1.0"
    authors = []

`src/main.rs`:

    pub fn main() {
        println!("Hello, world!");
    }

EDIT: I should add that this should fix #1472

@bors bors closed this in #1533 Apr 18, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment