summaryrefslogtreecommitdiff
path: root/cmd/planr/sub/config.go
blob: ee372c87274c7bf8f03edc060c9cacf54341efb8 (plain)
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
package sub

import (
	"golang.flu0r1ne.net/planr"
        "fmt"
        "os"
)


func Config(runner planr.Runner, params []string) {
  if len(params) != 1 {
    fmt.Fprintf(os.Stderr, "Usage: planr config <parameter>\n") 
    os.Exit(1)
  }

  key := params[0]

  switch key {
    case "builddir":
      fmt.Printf("%s\n", runner.BuildDir())
    case "configdir":
      fmt.Printf("%s\n", runner.ConfigDir())
    case "srcdir":
      fmt.Printf("%s\n", runner.SrcDir())
    default:
      fmt.Fprintf(os.Stderr, "\"%s\" not found in configuration\n", key)
  }
}