Skip to content

Commit

Permalink
Create pingpong.tengo
Browse files Browse the repository at this point in the history
  • Loading branch information
txthinking authored Jun 6, 2022
1 parent feb6766 commit a12b52c
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions package/pingpong.tengo
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
os := import("os")
fmt := import("fmt")
text := import("text")
nami := import("nami")
json := import("json")

b := nami.sh1(`curl`, `-L`, `https://api.github.com/repos/txthinking/pingpong/releases/latest`)
if is_error(b) {
fmt.println(b)
os.exit(1)
}
v := json.decode(b).tag_name
err := nami.write_file(text.join([nami.cache_dir, "version"], os.path_separator), v)
if is_error(err) {
fmt.println(err)
os.exit(1)
}

if nami.os == "darwin" && nami.arch == "arm64" {
err := nami.sh(`curl`, `-L`, `--progress-bar`, `https://github.com/txthinking/pingpong/releases/latest/download/pps_darwin_arm64`, `-o`, text.join([nami.cache_dir, "pps"], os.path_separator))
if is_error(err) {
fmt.println(err)
os.exit(1)
}
err = nami.sh(`curl`, `-L`, `--progress-bar`, `https://github.com/txthinking/pingpong/releases/latest/download/ppc_darwin_arm64`, `-o`, text.join([nami.cache_dir, "ppc"], os.path_separator))
if is_error(err) {
fmt.println(err)
os.exit(1)
}
}
if nami.os == "darwin" && nami.arch == "amd64" {
err := nami.sh(`curl`, `-L`, `--progress-bar`, `https://github.com/txthinking/pingpong/releases/latest/download/pps_darwin_amd64`, `-o`, text.join([nami.cache_dir, "pps"], os.path_separator))
if is_error(err) {
fmt.println(err)
os.exit(1)
}
err = nami.sh(`curl`, `-L`, `--progress-bar`, `https://github.com/txthinking/pingpong/releases/latest/download/ppc_darwin_amd64`, `-o`, text.join([nami.cache_dir, "ppc"], os.path_separator))
if is_error(err) {
fmt.println(err)
os.exit(1)
}
}
if nami.os == "linux" && nami.arch == "amd64" {
err := nami.sh(`curl`, `-L`, `--progress-bar`, `https://github.com/txthinking/pingpong/releases/latest/download/pps_linux_amd64`, `-o`, text.join([nami.cache_dir, "pps"], os.path_separator))
if is_error(err) {
fmt.println(err)
os.exit(1)
}
err = nami.sh(`curl`, `-L`, `--progress-bar`, `https://github.com/txthinking/pingpong/releases/latest/download/ppc_linux_amd64`, `-o`, text.join([nami.cache_dir, "ppc"], os.path_separator))
if is_error(err) {
fmt.println(err)
os.exit(1)
}
}
if nami.os == "windows" && nami.arch == "amd64" {
err := nami.sh(`curl`, `-L`, `--progress-bar`, `https://github.com/txthinking/pingpong/releases/latest/download/pps_windows_amd64.exe`, `-o`, text.join([nami.cache_dir, "pps.exe"], os.path_separator))
if is_error(err) {
fmt.println(err)
os.exit(1)
}
err = nami.sh(`curl`, `-L`, `--progress-bar`, `https://github.com/txthinking/pingpong/releases/latest/download/ppc_windows_amd64.exe`, `-o`, text.join([nami.cache_dir, "ppc.exe"], os.path_separator))
if is_error(err) {
fmt.println(err)
os.exit(1)
}
}

0 comments on commit a12b52c

Please sign in to comment.