Пример #1
0
	"path"
	"time"

	compile "./src/compile"
	config "./src/config"
	. "./src/data"
	input "./src/input"
	serve "./src/serve"
)

var port = opts.Single("p", "port", "the port to use", "8080")
var blogroot = opts.Single("r",
	"blogroot",
	"the root directory for blog data",
	"/usr/share/obsidian")
var showVersion = opts.Flag("", "version", "show version information")
var verbose = opts.Flag("v", "verbose", "give verbose output")

var startTime = time.Nanoseconds()

var (
	confFile    string
	templateDir string
	postDir     string
	pageDir     string
	dataDir     string
)

func main() {
	// option setup
	opts.Description = "lightweight http blog server"
Пример #2
0
package main

import (
	. "container/vector"
	"fmt"
	"go/ast"
	"go/parser"
	"opts"
	"os"
	"path"
	"strings"
)

var showVersion = opts.LongFlag("version", "display version information")
var showNeeded = opts.Flag("n", "need", "display external dependencies")
var srcRoot = opts.Half("r", "root", "root directory of the source", "", "src")
var progName = "godep"

var roots = map[string]string{}

// prefix the root
func mkRoot(str string) string {
	return path.Join(*srcRoot, str)
}

func main() {
	opts.Usage = "[file1.go [...]]"
	opts.Description =
		`construct and print a dependency tree for the given source files.`
		// parse and handle options