diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..119a201 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +runflow diff --git a/README.md b/README.md index 8f597cd..6af6d9e 100644 --- a/README.md +++ b/README.md @@ -1 +1,6 @@ -# rfsh +# RFSH: Flows running made fast, safe, easy. +> a.k.a @RUNFLOW_SH + +``` +$curl https://github.com/raw/docsion/rfsh/main/i.sh | sh +``` diff --git a/i.sh b/i.sh new file mode 100644 index 0000000..dda7d6b --- /dev/null +++ b/i.sh @@ -0,0 +1,33 @@ +#!/bin/sh +set -e + +echo "Hey @RUNFLOW_SH here!" +RELEASES_URL="https://github.com/docsion/rfsh/releases" +FILE_BASENAME="runflow_sh" +LATEST="$(curl -sf https://github.com/raw/docsion/rfsh/main/latest)" + +test -z "$VERSION" && VERSION="$LATEST" + +test -z "$VERSION" && { + echo "Unable to get runflow_sh version." >&2 + exit 1 +} + +TMP_DIR="$(mktemp -d)" +# shellcheck disable=SC2064 # intentionally expands here +trap "rm -rf \"$TMP_DIR\"" EXIT INT TERM +OS="$(uname -s)" +ARCH="$(uname -m)" +# test "$ARCH" = "aarch64" && ARCH="arm64" +TAR_FILE="${FILE_BASENAME}_${OS}_${ARCH}.tar.gz" + +( + cd "$TMP_DIR" + echo "Downloading runflow_sh $VERSION..." + curl -sfLO "$RELEASES_URL/download/$VERSION/$TAR_FILE" +) + +tar -xf "$TMP_DIR/$TAR_FILE" -C "$TMP_DIR" +mv "$TMP_DIR/runflow_sh" ./runflow +echo "Done" $(pwd)/runflow + diff --git a/latest b/latest new file mode 100644 index 0000000..04e1946 --- /dev/null +++ b/latest @@ -0,0 +1 @@ +v0.1.3 diff --git a/rf.sh b/rf.sh new file mode 100644 index 0000000..52f35a4 --- /dev/null +++ b/rf.sh @@ -0,0 +1,31 @@ +#!/bin/sh +set -e + +echo "Hey @RUNFLOW_SH here!" +RELEASES_URL="https://github.com/docsion/rfsh/releases" +FILE_BASENAME="runflow_sh" +LATEST="$(curl -sf https://github.com/raw/docsion/rfsh/main/latest)" + +test -z "$VERSION" && VERSION="$LATEST" + +test -z "$VERSION" && { + echo "Unable to get runflow_sh version." >&2 + exit 1 +} + +TMP_DIR="$(mktemp -d)" +# shellcheck disable=SC2064 # intentionally expands here +trap "rm -rf \"$TMP_DIR\"" EXIT INT TERM +OS="$(uname -s)" +ARCH="$(uname -m)" +# test "$ARCH" = "aarch64" && ARCH="arm64" +TAR_FILE="${FILE_BASENAME}_${OS}_${ARCH}.tar.gz" + +( + cd "$TMP_DIR" + echo "Downloading runflow_sh $VERSION..." + curl -sfLO "$RELEASES_URL/download/$VERSION/$TAR_FILE" +) + +tar -xf "$TMP_DIR/$TAR_FILE" -C "$TMP_DIR" +"$TMP_DIR/runflow_sh" "$@" diff --git a/sample/sample.csv b/sample/sample.csv new file mode 100644 index 0000000..f5896e9 --- /dev/null +++ b/sample/sample.csv @@ -0,0 +1,15 @@ +id,content +1,the normal +2,"with , comma" +3,"with +end +line " +4,"with , comma +end +line" +5,the utf8 nội dung +59058,the real content id +59058,"real content with , comma +end +line" +8,"[""cơm tấm 30k"",""cơm tấm tân phú""]" diff --git a/sample/sample.out.csv b/sample/sample.out.csv new file mode 100644 index 0000000..fd1cd24 --- /dev/null +++ b/sample/sample.out.csv @@ -0,0 +1,29 @@ +id,content,RFSH_status,RFSH_good,RFSH_bad +1,the normal,good,"hello bash runner 1 the normal +", +3,"with +end +line ",good,"hello bash runner 3 with +end +line +", +4,"with , comma +end +line",good,"hello bash runner 4 with , comma +end +line +", +2,"with , comma",good,"hello bash runner 2 with , comma +", +5,the utf8 nội dung,good,"hello bash runner 5 the utf8 nội dung +", +59058,the real content id,good,"hello bash runner 59058 the real content id +", +59058,"real content with , comma +end +line",good,"hello bash runner 59058 real content with , comma +end +line +", +8,"[""cơm tấm 30k"",""cơm tấm tân phú""]",good,"hello bash runner 8 [cơm tấm 30k,cơm tấm tân phú] +", diff --git a/sample/sample.template b/sample/sample.template new file mode 100644 index 0000000..5aa8f36 --- /dev/null +++ b/sample/sample.template @@ -0,0 +1 @@ +echo "hello bash runner {{id}} {{content}}"