gapi: Add a prefix variable in case we want to namespace on disk
This could get passed through to use as a module download path.
This commit is contained in:
@@ -50,6 +50,7 @@ type Data struct {
|
||||
Noop bool
|
||||
NoConfigWatch bool
|
||||
NoStreamWatch bool
|
||||
Prefix string
|
||||
Debug bool
|
||||
Logf func(format string, v ...interface{})
|
||||
// NOTE: we can add more fields here if needed by GAPI endpoints
|
||||
|
||||
@@ -38,6 +38,9 @@ type Pos struct {
|
||||
// InterpolateInfo contains some information passed around during interpolation.
|
||||
// TODO: rename to Info if this is moved to its own package.
|
||||
type InterpolateInfo struct {
|
||||
// Prefix used for path namespacing if required.
|
||||
Prefix string
|
||||
|
||||
// Debug represents if we're running in debug mode or not.
|
||||
Debug bool
|
||||
|
||||
@@ -73,6 +76,7 @@ func InterpolateStr(str string, pos *Pos, info *InterpolateInfo) (interfaces.Exp
|
||||
}
|
||||
|
||||
transformInfo := &InterpolateInfo{
|
||||
Prefix: info.Prefix,
|
||||
Debug: info.Debug,
|
||||
Logf: func(format string, v ...interface{}) {
|
||||
info.Logf("transform: "+format, v...)
|
||||
|
||||
@@ -47,6 +47,7 @@ type Lang struct {
|
||||
Input io.Reader // os.Stdin or anything that satisfies this interface
|
||||
Hostname string
|
||||
World engine.World
|
||||
Prefix string
|
||||
Debug bool
|
||||
Logf func(format string, v ...interface{})
|
||||
|
||||
|
||||
@@ -481,6 +481,7 @@ func (obj *Main) Run() error {
|
||||
//NoWatch: obj.NoWatch,
|
||||
NoConfigWatch: obj.NoConfigWatch,
|
||||
NoStreamWatch: obj.NoStreamWatch,
|
||||
Prefix: fmt.Sprintf("%s/", path.Join(prefix, "gapi")),
|
||||
Debug: obj.Flags.Debug,
|
||||
Logf: func(format string, v ...interface{}) {
|
||||
log.Printf("gapi: "+format, v...)
|
||||
|
||||
Reference in New Issue
Block a user