wecisecode 2 giorni fa
parent
commit
046306dd59
3 ha cambiato i file con 18 aggiunte e 11 eliminazioni
  1. 1 1
      odbctest/mql/make.sh
  2. 3 2
      odbctest/mql/mqltest.sh
  3. 14 8
      odbctest/odbcmql/mql_run.go

+ 1 - 1
odbctest/mql/make.sh

@@ -28,7 +28,7 @@ echo "${newdirinfo}" > mqldirinfo
 }
 
 
-newdirinfo=`ls -lrt *.go`
+newdirinfo=`ls -lrt *.go ../odbcmql/*.go ../../go.*`
 dirinfo=`cat mqldirinfo`
 if [[ "${dirinfo}" != "${newdirinfo}" || "$1" == "force" ]]; then
     buildmql

+ 3 - 2
odbctest/mql/mqltest.sh

@@ -42,12 +42,13 @@ if [[ "${keyspace}" != "" ]]; then
 fi
 sleep 2
 
-filepath=`echo "$@" | awk '{print $NF}'`
-if [[ "${filepath}" == "" ]]; then
+filescount="./mql files? log.level=error "$@" | wc -l`
+if [[ "${filescount}" == "0" || "${filescount}" == "1" ]]; then
     ./mql "$@"
     exit $?
 fi
 
+filepath=`echo "$@" | awk '{print $NF}'`
 # remove ./
 filepath=${filepath/\.\//}
 # remove last slash

+ 14 - 8
odbctest/odbcmql/mql_run.go

@@ -224,6 +224,20 @@ mql语句扩展说明:
 		return
 	}
 
+	// 文件名以数字开头
+	fnmatch := mcfg.CommandArgs.GetString("match", `^\d+.*`)
+	fw, err := filewalker.NewFileWalker(spath, fnmatch) // orderby: dirfirst, filefirst, fullpath
+	if !assert.Nil(t, err, err) {
+		return
+	}
+	fns := []string{}
+	fw.List(func(basedir, fpath string) bool { fns = append(fns, filepath.Join(basedir, fpath)); return true })
+
+	if mcfg.CommandArgs.GetString("files?") == "files?" {
+		fmt.Println(strings.Join(fns, "\n"))
+		os.Exit(0)
+	}
+
 	// 确定MODB连接
 	if !assert.Nil(t, ODBError) {
 		return
@@ -240,18 +254,10 @@ mql语句扩展说明:
 	// 	return
 	// }
 
-	// 文件名以数字开头
-	fnmatch := mcfg.CommandArgs.GetString("match", `^\d+.*`)
-	fw, err := filewalker.NewFileWalker(spath, fnmatch) // orderby: dirfirst, filefirst, fullpath
-	if !assert.Nil(t, err, err) {
-		return
-	}
 	logger.Info("walkdir: ", fw.WalkDir)
 	logger.Info("pathmatch: ", fw.RePath)
 	logger.Info("filematch: ", fw.ReFile)
 	// test
-	fns := []string{}
-	fw.List(func(basedir, fpath string) bool { fns = append(fns, filepath.Join(basedir, fpath)); return true })
 
 	if len(fns) > 1 {
 		appfile, err := filepath.Abs(os.Args[0])