From e6a58825117d8b4ef9d7eff99557fbf5248d35aa Mon Sep 17 00:00:00 2001 From: mpl Date: Fri, 15 Mar 2013 19:26:24 +0100 Subject: [PATCH] website doc: cmds: golang style + install command Change-Id: I4f38dfb87e066ef81881bc9a2262c52109e172c9 --- cmd/camget/doc.go | 3 +-- cmd/cammount/doc.go | 17 +++++++++-------- cmd/camput/doc.go | 8 ++++---- cmd/camtool/doc.go | 6 +++--- website/camweb.go | 8 ++++++++ website/godoc.go | 5 +++-- 6 files changed, 28 insertions(+), 19 deletions(-) diff --git a/cmd/camget/doc.go b/cmd/camget/doc.go index 72c03722c..9f5166447 100644 --- a/cmd/camget/doc.go +++ b/cmd/camget/doc.go @@ -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: diff --git a/cmd/cammount/doc.go b/cmd/cammount/doc.go index ba7713808..e30e7ea9e 100644 --- a/cmd/cammount/doc.go +++ b/cmd/cammount/doc.go @@ -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] [|] - -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] [|] + -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 diff --git a/cmd/camput/doc.go b/cmd/camput/doc.go index 4bc0ff54f..5dd935fd7 100644 --- a/cmd/camput/doc.go +++ b/cmd/camput/doc.go @@ -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] [commandopts] [commandargs] +Usage: + + camput [globalopts] [commandopts] [commandargs] Modes: diff --git a/cmd/camtool/doc.go b/cmd/camtool/doc.go index a4fd2da1e..eb36d4855 100644 --- a/cmd/camtool/doc.go +++ b/cmd/camtool/doc.go @@ -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] [commandopts] [commandargs] +Usage: + + camtool [globalopts] [commandopts] [commandargs] Modes: diff --git a/website/camweb.go b/website/camweb.go index 7e357e35d..e344af680 100644 --- a/website/camweb.go +++ b/website/camweb.go @@ -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 := ` +

Installation

+
go get camlistore.org/cmd/` + subtitle + `
+

Overview

` + content = bytes.Replace(content, []byte("

"), []byte(toInsert), 1) + } d := struct { Title string Subtitle string diff --git a/website/godoc.go b/website/godoc.go index f79a0a4f9..e791d15d7 100644 --- a/website/godoc.go +++ b/website/godoc.go @@ -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)) }