Merge "website doc: cmds: golang style + install command"

This commit is contained in:
mpl 2013-03-15 22:05:26 +00:00 committed by Gerrit Code Review
commit f1c5a12085
6 changed files with 28 additions and 19 deletions

View File

@ -15,10 +15,9 @@ limitations under the License.
*/
/*
$ go get camlistore.org/cmd/camget
The camget tool fetches blobs, files, and directories.
Examples
Writes to stdout by default:

View File

@ -15,15 +15,16 @@ limitations under the License.
*/
/*
$ go get camlistore.org/cmd/cammount
The cammount tool mounts a root directory blob onto the given mountpoint. The blobref can be given directly or through a share blob URL. If no root blobref is given, an automatic root is created instead.
usage: cammount [opts] <mountpoint> [<root-blobref>|<share URL>]
-debug=false: print debugging messages.
-server="": Camlistore server prefix.
If blank, the default from the "server" field of ~/.camlistore/config is used.
Acceptable forms: https://you.example.com, example.com:1345 (https assumed), or
http://you.example.com/alt-root
Usage:
cammount [opts] <mountpoint> [<root-blobref>|<share URL>]
-debug=false: print debugging messages.
-server="": Camlistore server prefix.
If blank, the default from the "server" field of ~/.camlistore/config is used.
Acceptable forms: https://you.example.com, example.com:1345 (https assumed), or
http://you.example.com/alt-root
*/
package main

View File

@ -15,12 +15,12 @@ limitations under the License.
*/
/*
$ go get camlistore.org/cmd/camput
The camput tool mainly pushes blobs, files, and directories. It can also perform various tasks related to that, such as setting tags, creating permanodes, an creating share blobs.
The camput tool mainly pushes blobs, files, and directories. It can also perform various related tasks, such as setting tags, creating permanodes, and creating share blobs.
Usage: camput [globalopts] <mode> [commandopts] [commandargs]
Usage:
camput [globalopts] <mode> [commandopts] [commandargs]
Modes:

View File

@ -15,12 +15,12 @@ limitations under the License.
*/
/*
$ go get camlistore.org/cmd/camtool
Camtool is a collection of commands to help with the use of a camlistore server. Notably, it can initialize a database for the indexer, and it can sync blobs between blobservers.
Usage: camtool [globalopts] <mode> [commandopts] [commandargs]
Usage:
camtool [globalopts] <mode> [commandopts] [commandargs]
Modes:

View File

@ -119,6 +119,14 @@ func applyTemplate(t *template.Template, name string, data interface{}) []byte {
}
func servePage(w http.ResponseWriter, title, subtitle string, content []byte) {
// insert an "install command" if it applies
if strings.Contains(title, cmdPattern) && subtitle != cmdPattern {
toInsert := `
<h3>Installation</h3>
<pre>go get camlistore.org/cmd/` + subtitle + `</pre>
<h3>Overview</h3><p>`
content = bytes.Replace(content, []byte("<p>"), []byte(toInsert), 1)
}
d := struct {
Title string
Subtitle string

View File

@ -423,6 +423,7 @@ func (godocHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
title := pathpkg.Base(diskPath) + " (" + pkgName + ")"
servePage(w, title, "", applyTextTemplate(packageHTML, "packageHTML", pi))
subtitle := pathpkg.Base(diskPath)
title := subtitle + " (" + pkgName + ")"
servePage(w, title, subtitle, applyTextTemplate(packageHTML, "packageHTML", pi))
}