run:
go build
then run binary file, expected print:
def
{ | |
"include": [ | |
"node_modules/tdesign-vue-next/global.d.ts" | |
] | |
} |
{ | |
"compilerOptions": { | |
"types": ["tdesign-vue-next/global"] | |
} | |
} |
package main | |
import ( | |
"context" | |
"fmt" | |
"time" | |
) | |
func main() { | |
ctx, cancel := context.WithCancel(context.Background()) |
#!/bin/sh | |
# These vars and func are used to get value from a key=value file | |
# It will also trim the leading and trailing whitespace, tab | |
# Key with space after or before is supported | |
getVal(){ | |
# cut `=` in val: https://unix.stackexchange.com/a/53315/207518 | |
# grep: allow space after or before of key | |
# awk trim space after and before of value: https://unix.stackexchange.com/a/205854/207518 | |
declare val=$(cat ${1} | grep "^ *${2} *=" | cut -d '=' -f 2- | awk '{$1=$1}1') |
@ECHO OFF | |
REM https://stackoverflow.com/a/9681923/2752670 | |
SET myKey=abc2 | |
SET myFile=keyval.txt | |
CALL :GetVal %myFile% %myKey% myVal | |
REM is string empty https://stackoverflow.com/a/2541820/2752670 | |
IF [%myVal%] == [] ( | |
ECHO no key: %myKey% in file: %myFile% | |
) ELSE ( |