-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoc.go
More file actions
44 lines (44 loc) · 1.05 KB
/
doc.go
File metadata and controls
44 lines (44 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Simple Example, used like package `http`:
//
// package main
//
// import (
// "fmt"
// "os"
//
// "github.com/choueric/cmdmux"
// )
//
// type Options struct {
// arch string
// }
//
// func rootHandler(args []string, data interface{}) (int, error) {
// fmt.Println("Usage:")
// cmdmux.PrintTree(os.Stderr)
// return 0, nil
// }
//
// func buildHandler(args []string, data interface{}) (int, error) {
// opt := data.(*Options)
// fmt.Printf("invoke 'build' of %s\n", opt.arch)
// return 1, nil
// }
//
// func buildKernelHandler(args []string, data interface{}) (int, error) {
// fmt.Printf("invoke 'build kernel', args = %v\n", args)
// return 2, nil
// }
//
// func main() {
// opt := &Options{arch: "arm"}
//
// cmdmux.HandleFunc("/", rootHandler)
// cmdmux.HandleFunc("/build", buildHandler)
// cmdmux.HandleFunc("/build/kernel", buildKernelHandler)
// cmdmux.HandleFunc("/build/kernel/image", buildKernelHandler)
// cmdmux.HandleFunc("/build/uboot", buildKernelHandler)
//
// cmdmux.Execute(opt)
// }
package cmdmux