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

Fix Issue 17998 - Document Options for install.sh #1936

Merged
merged 10 commits into from
Dec 19, 2017

Conversation

wilzbach
Copy link
Member

@wilzbach wilzbach commented Dec 2, 2017

While this isn't perfect, it should provide a good basis for continuous improvements ;-)

I wasn't sure whether ~/dlang/install.sh or ./install.sh should be the recommended invocation.

CC @MartinNowak @ZombineDev

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Auto-close Bugzilla Description
17998 Document Options for install.sh

@PetarKirov
Copy link
Member

Thanks, this was on my to do list as well ;)

Copy link
Member

@PetarKirov PetarKirov left a comment

Choose a reason for hiding this comment

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

Thanks for pushing this forward!

install.dd Outdated

$(D_S $(TITLE),

$(UL
Copy link
Member

Choose a reason for hiding this comment

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

I would like to start with a dense overview paragraph that gives reader an idea what this is all about.
What do you think about an introductory paragraph, along the lines of:

Introduction

The dlang.org/install.sh script is the official D version manager for DMD, GDC and LDC on FreeBSD, Linux and macOS.
Its features include:

  • Maintaining one or more portable compiler installations in the user's home directory (~/dlang/)
  • Maintaining the latest stable version of Dub (multiple dub version are not supported)
  • Self-updating via ~/dlang/install.sh update
  • Working without require administrative privileges
  • Minimal external dependencies (NOTE: I'm not sure if it makes sense to document commands used, besides curl, as this can easily go out of sync with the source, but still we should mention what the users needs to have on his system).
  • Supports nested activation of compilers. Activating a compiler, will setup the PATH, LIBRARY_PATH, LD_LIBRARY_PATH, DMD, DC, and PS1 environment variables. After activation, user's can revert those variables to their old values by invoking the deactivate command, added to current shell session, by the activation command.
  • Supports Fish shell, in addition to Bash-compatible shells.
  • For dmd, the installation of following versions is supported:
    • dmd - latest stable version
    • dmd-beta - latest beta version
    • dmd-nightly - the latest nightly release
    • dmd-<version> - specific official release (including beta releases)
    • dmd-branch - experimental compiler branches
  • For ldc, the installation of following versions is supported:
    • ldc - latest stable version
    • ldc-beta - latest beta version
    • ldc-<version> - specific official release (including beta releases)
  • For gdc, the installation of following versions is supported:
    • gdc - latest stable version

(Sorry for not writing directly in DDoc, but I am not the go.)

install.dd Outdated
$(H2 $(LNAME2 usage, Usage))

$(CONSOLE
./install.sh [&lt;command&gt;] [&lt;args&gt;]
Copy link
Member

Choose a reason for hiding this comment

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

Always use ~/dlang/install.sh. Avoid using relative paths, especially in documentation.

@wilzbach
Copy link
Member Author

wilzbach commented Dec 7, 2017

What do you think about an introductory paragraph, along the lines of:

I like it. I converted your text to Ddoc and made a few changes. Please feel free to improve upon them ;-)

Copy link
Member

@andralex andralex left a comment

Choose a reason for hiding this comment

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

see review

install.dd Outdated
If you want, you can directly invoke it:

$(CONSOLE
curl https://dlang.org/install.sh | bash -s
Copy link
Member

Choose a reason for hiding this comment

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

I recall someone (@CyberShadow?) quoted a scathing article about this practice. Perhaps it would be best to not mention it.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Well we do mention it on the downloads page too:

image

install.dd Outdated
wget https://dlang.org/install.sh
)

If you want, you can directly invoke it:
Copy link
Member

Choose a reason for hiding this comment

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

Oh, also please avoid the use of "you" in documentation.

s/If you want, you can directly invoke it/Alternatively, the script can be invoked directly/

install.dd Outdated

$(P Once a compiler can be activated for the current session:)

Run the respective `activate` script in your shell to use a compiler by default:
Copy link
Member

Choose a reason for hiding this comment

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

s/your shell/the shell/

Use the recently introduced on hover info button on the downloads page
to show a link to the install.sh script documentation.
@wilzbach
Copy link
Member Author

Okay addressed the feedback.
I also switched to use the recently introduced "info on hover" button on the downloads page to link to the script documentation (instead of simply using "Explain").

install.dd Outdated
$(EXAMPLES
~/dlang/install.sh uninstall dmd
/install.sh uninstall dmd-2.071.1
/install.sh uninstall ldc-1.1.0-beta2
Copy link
Member

Choose a reason for hiding this comment

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

Use ~/dlang/install.sh here too. It looks a bit confusing, otherwise.

install.dd Outdated
Run the respective `activate` script in a shell to use a compiler by default:

$(CONSOLE
source ~/dlang/&lt;installed-compiler&gt;/activate
Copy link
Member

Choose a reason for hiding this comment

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

You should also mention that for fish shell the command is:

source ~/dlang/&lt;installed-compiler&gt;/activate.fish

~/dlang/install.sh dmd
~/dlang/install.sh install dmd
~/dlang/install.sh install dmd-2.071.1
~/dlang/install.sh install ldc-1.1.0-beta2
Copy link
Member

Choose a reason for hiding this comment

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

Just for completeness (and easy copy-pasting) can you mention also:

~/dlang/install.sh install dmd-beta
~/dlang/install.sh install dmd-nightly

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. done

Copy link
Contributor

@joakim-noah joakim-noah left a comment

Choose a reason for hiding this comment

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

My tweaks

install.dd Outdated

$(H2 Introduction)

The $(LINK2 https://dlang.org/install.sh, `dlang.org/install.sh`) script is the official D version manager for DMD, GDC and LDC on FreeBSD, Linux and macOS and provides a convenient way to fetch and install a D compiler without requiring administrative privileges nor external dependencies.
Copy link
Contributor

Choose a reason for hiding this comment

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

Sentence is too long, break it with macOS. It provides.

install.dd Outdated

$(UL
$(LI Maintaining one or more portable compiler installations in the user's home directory (`~/dlang`))
$(LI Maintaining the latest stable version of $(LINK2 http://code.dlang.org/docs/commandline, `dub`))
Copy link
Contributor

Choose a reason for hiding this comment

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

Introduce dub, don't assume they know it, the D package manager, dub.

install.dd Outdated
$(LI Maintaining one or more portable compiler installations in the user's home directory (`~/dlang`))
$(LI Maintaining the latest stable version of $(LINK2 http://code.dlang.org/docs/commandline, `dub`))
$(LI Self-updating via `~/dlang/install.sh update`)
$(LI Supporting nested activation of compilers. Activating a compiler, will setup the `PATH`, `LIBRARY_PATH`, `LD_LIBRARY_PATH`, `DMD`, `DC`, and `PS1` environment variables. After activation, user's can revert those variables to their old values by invoking the `deactivate` command, added to current shell session, by the activation command.)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it "nested?" Can you activate a compiler inside another one's session?

Merge last sentence:

variables and a deactivate command, which reverts the variables to their old values.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you activate a compiler inside another one's session?

Yes it's a stack.

install.dd Outdated
curl https://dlang.org/install.sh | bash -s
)

$(P If no argument are provided, the latest DMD compiler will be installed.)
Copy link
Contributor

Choose a reason for hiding this comment

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

arguments

install.dd Outdated

$(P If no argument are provided, the latest DMD compiler will be installed.)

$(P The installer will also install a copy of itself to `~/dlang/install.sh`.)
Copy link
Contributor

Choose a reason for hiding this comment

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

also make a copy of itself at

install.dd Outdated
Installs the latest beta version of a compiler)
$(SWITCH $(SWNAME dmd-nightly),
Installs DMD nightly)
$(SWITCH $(SWNAME dmd-20170-02-10),
Copy link
Contributor

Choose a reason for hiding this comment

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

2017-

install.dd Outdated
~/dlang/install.sh install ldc-1.1.0-beta2
)

$(P Once a compiler can be activated for the current session:)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why put this in its own paragraph? Merge it with the next sentence instead session, run the

@wilzbach
Copy link
Member Author

@ZombineDev @joakim-noah thanks a lot for your feedback! Addressed.

install.dd Outdated
$(H2 $(LNAME2 get, Downloading the installer))

$(CONSOLE
wget https://dlang.org/install.sh
Copy link
Member Author

Choose a reason for hiding this comment

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

How about:

mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, better to have a consistent install location, if the curl method installs it differently.

install.dd Outdated
~/dlang/&lt;installed-ldc-compiler&gt;/ldc2
)

Users of the $(LINK2 https://fishshell.com, Fish shell), can `activate.fish`:
Copy link
Member Author

Choose a reason for hiding this comment

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

I put the note about the FISH shell at the end of this section as AFAICT it's not a very popular shell and it stops the reading flow awkwardly if put in-between.

Copy link
Contributor

Choose a reason for hiding this comment

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

No comma after shell),

Copy link
Contributor

@joakim-noah joakim-noah left a comment

Choose a reason for hiding this comment

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

A few more tweaks

install.dd Outdated
$(LI Maintaining one or more portable compiler installations in the user's home directory (`~/dlang`))
$(LI Maintaining the latest stable version of the D package manager, $(LINK2 http://code.dlang.org/docs/commandline, `dub`))
$(LI Self-updating via `~/dlang/install.sh update`)
$(LI Supporting nested activation of compilers. Activating a compiler, will setup the `PATH`, `LIBRARY_PATH`, `LD_LIBRARY_PATH`, `DMD`, `DC`, and `PS1` environment variables, and a `deactivate` command, which reverts the modified variables to their old values.)
Copy link
Contributor

Choose a reason for hiding this comment

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

No comma needed after compiler, and variables,

Copy link
Member Author

Choose a reason for hiding this comment

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

You are absolutely right about the first occurrence, but isn't the second one the Oxford comma?
I reworded it slightly:

will setup the PATH, LIBRARY_PATH, .. PS1 environment variables, and a deactivate command

install.dd Outdated
$(LI Maintaining the latest stable version of the D package manager, $(LINK2 http://code.dlang.org/docs/commandline, `dub`))
$(LI Self-updating via `~/dlang/install.sh update`)
$(LI Supporting nested activation of compilers. Activating a compiler, will setup the `PATH`, `LIBRARY_PATH`, `LD_LIBRARY_PATH`, `DMD`, `DC`, and `PS1` environment variables, and a `deactivate` command, which reverts the modified variables to their old values.)
$(LI Supporting Fish shell, in addition to Bash-compatible shells.)
Copy link
Contributor

Choose a reason for hiding this comment

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

the Fish

install.dd Outdated
$(H2 $(LNAME2 get, Downloading the installer))

$(CONSOLE
wget https://dlang.org/install.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, better to have a consistent install location, if the curl method installs it differently.

install.dd Outdated
~/dlang/&lt;installed-ldc-compiler&gt;/ldc2
)

Users of the $(LINK2 https://fishshell.com, Fish shell), can `activate.fish`:
Copy link
Contributor

Choose a reason for hiding this comment

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

No comma after shell),

install.dd Outdated
)

Alternatively, it is also possible to directly use a compiler by calling its
binary directly.
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace end with possible to call the compiler binary directly.

@JinShil
Copy link
Contributor

JinShil commented Dec 19, 2017

This is really good, but we are introducing a maintenance burden and a fragile synchronization between this file and install.sh. Would it not be better to add this documentation to the --help output of install.sh and maybe generate this file as part of the build?

Copy link
Contributor

@JinShil JinShil left a comment

Choose a reason for hiding this comment

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

Regardless, it's better to have it than not have it.

Copy link
Contributor

@joakim-noah joakim-noah left a comment

Choose a reason for hiding this comment

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

No more tweaks, maybe linux shouldn't be capitalized, like macOS

@wilzbach
Copy link
Member Author

but we are introducing a maintenance burden and a fragile synchronization between this file and install.sh. Would it not be better to add this documentation to the --help output of install.sh and maybe generate this file as part of the build?

Of course it would be better, but that's pretty difficult to do all the custom text, explanations and formatting.
I don't think that this file changes much (the installer has about 2-3 pull requests per month and they are mostly just upgrades to the release build system), so that it's worth looking into the effort of generating the page automatically.

OTOH the compiler help page changes quite a lot and we are incredibly bad in keeping it up to date. So if we want to invest time in generating something automatically, I think the dmd-*.html pages are a better candidate.

@dlang-bot dlang-bot merged commit 04bf20e into dlang:master Dec 19, 2017
@wilzbach wilzbach deleted the fix-17998 branch December 19, 2017 03:10
@wilzbach
Copy link
Member Author

maybe linux shouldn't be capitalized

Hmm, I have only seen it written capitalized except for DMD's inconsistent version file.

(Also I am terribly sorry for forgetting to squash this. We really need to re-enable auto-merge-squash.)

@MartinNowak
Copy link
Member

Would it not be better to add this documentation to the --help output of install.sh and maybe generate this file as part of the build?

Indeed figuring out how we can base those things on a common man-page like document would be helpful, but not that urgent as it's rarely changing.
https://github.com/fish-shell/fish-shell/blob/f563262cfda72aa291dcca4cd703b2ccba3331a9/share/tools/create_manpage_completions.py
What could be done fairly easily is dumping the outputs of ./install.sh --help, ./install.sh <cmd> --help verbatim into a code block, but it's less versatile than the docs in this PR.

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

Successfully merging this pull request may close these issues.

8 participants