cmptest: regexdemo (todo)
This commit is contained in:
11
_cmptest/_regexdemo/regex.go
Normal file
11
_cmptest/_regexdemo/regex.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/goplus/llgo/xtool/env"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Println(env.ExpandEnv("$(pkg-config --libs bdw-gc)"))
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/goplus/llgo/cmd/internal/base"
|
"github.com/goplus/llgo/cmd/internal/base"
|
||||||
"github.com/goplus/llgo/xtool/env"
|
"github.com/goplus/llgo/x/env"
|
||||||
)
|
)
|
||||||
|
|
||||||
// llgo version
|
// llgo version
|
||||||
|
|||||||
0
xtool/env/build.go → x/env/build.go
vendored
0
xtool/env/build.go → x/env/build.go
vendored
0
xtool/env/version.go → x/env/version.go
vendored
0
xtool/env/version.go → x/env/version.go
vendored
3
xtool/env/env.go
vendored
3
xtool/env/env.go
vendored
@@ -36,11 +36,8 @@ func ExpandEnv(s string) string {
|
|||||||
func expandEnvWithCmd(s string) string {
|
func expandEnvWithCmd(s string) string {
|
||||||
expanded := reSubcmd.ReplaceAllStringFunc(s, func(m string) string {
|
expanded := reSubcmd.ReplaceAllStringFunc(s, func(m string) string {
|
||||||
subcmd := strings.TrimSpace(m[2 : len(m)-1])
|
subcmd := strings.TrimSpace(m[2 : len(m)-1])
|
||||||
|
|
||||||
args := parseSubcmd(subcmd)
|
args := parseSubcmd(subcmd)
|
||||||
|
|
||||||
cmd := args[0]
|
cmd := args[0]
|
||||||
|
|
||||||
if cmd != "pkg-config" && cmd != "llvm-config" {
|
if cmd != "pkg-config" && cmd != "llvm-config" {
|
||||||
fmt.Fprintf(os.Stderr, "expand cmd only support pkg-config and llvm-config: '%s'\n", subcmd)
|
fmt.Fprintf(os.Stderr, "expand cmd only support pkg-config and llvm-config: '%s'\n", subcmd)
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
Reference in New Issue
Block a user