@ahqstore/cli 0.10.2 → 0.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.toml CHANGED
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  edition = "2021"
3
3
  name = "ahqstore_cli_rs"
4
- version = "0.10.2"
4
+ version = "0.10.4"
5
5
  description = "AHQ Store CLI"
6
6
  repository = "https://github.com/ahqstore/cli"
7
7
  homepage = "https://github.com/ahqstore/cli"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahqstore/cli",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "description": "AHQ Store Official CLI, A port of the rust version to NodeJS",
5
5
  "keywords": [
6
6
  "cli",
package/go/ahqstore.go DELETED
@@ -1,166 +0,0 @@
1
- package main
2
-
3
- import (
4
- "fmt"
5
- "io"
6
- "net/http"
7
- "os"
8
- "path"
9
- "runtime"
10
-
11
- "github.com/ebitengine/purego"
12
- "github.com/schollz/progressbar/v3"
13
- )
14
-
15
- const version = "0.10.2"
16
-
17
- func main() {
18
- var bin = getBinary()
19
-
20
- var libahqstore, err = openLibrary(bin)
21
-
22
- if err != nil {
23
- Download(bin)
24
- libahqstore, err = openLibrary(bin)
25
-
26
- if err != nil {
27
- os.Exit(1)
28
- }
29
- }
30
-
31
- var get_ver func() string
32
- purego.RegisterLibFunc(&get_ver, libahqstore, "get_ver")
33
-
34
- if get_ver() != version {
35
- unloadLibrary(libahqstore)
36
-
37
- os.Remove(bin)
38
-
39
- Download(bin)
40
- libahqstore, err = openLibrary(bin)
41
-
42
- if err != nil {
43
- os.Exit(1)
44
- }
45
- }
46
-
47
- var init_args func()
48
- purego.RegisterLibFunc(&init_args, libahqstore, "init_args")
49
-
50
- init_args()
51
-
52
- var add_arg func(string)
53
- purego.RegisterLibFunc(&add_arg, libahqstore, "add_arg")
54
-
55
- for i := 1; i < len(os.Args); i++ {
56
- add_arg(os.Args[i])
57
- }
58
-
59
- var node_entrypoint func(bool)
60
- purego.RegisterLibFunc(&node_entrypoint, libahqstore, "node_entrypoint")
61
-
62
- node_entrypoint(
63
- os.Getenv("CI") == "true",
64
- )
65
- }
66
-
67
- func Download(file string) {
68
- var prefix, suffix = GetPrefixSuffix()
69
- var triple, _ = GetRustTargetTriple()
70
-
71
- var url = fmt.Sprintf("https://github.com/ahqstore/cli/releases/download/%s/%sahqstore_cli_rs-%s%s", version, prefix, triple, suffix)
72
-
73
- var req, _ = http.NewRequest("GET", url, nil)
74
- var resp, err = http.DefaultClient.Do(req)
75
-
76
- if err != nil {
77
- fmt.Println("Could not connect to download the required dynamic library")
78
- os.Exit(1)
79
- }
80
- defer resp.Body.Close()
81
-
82
- bar := progressbar.DefaultBytes(
83
- resp.ContentLength,
84
- "Downloading...",
85
- )
86
-
87
- defer bar.Finish()
88
-
89
- var f, _ = os.OpenFile(file, os.O_WRONLY|os.O_CREATE, os.ModePerm)
90
- defer f.Close()
91
-
92
- io.Copy(io.MultiWriter(f, bar), resp.Body)
93
- }
94
-
95
- func GetPrefixSuffix() (string, string) {
96
- switch runtime.GOOS {
97
- case "windows":
98
- return "", ".dll"
99
- case "darwin":
100
- return "lib", ".dylib"
101
- default:
102
- return "lib", ".so"
103
- }
104
- }
105
-
106
- func GetRustTargetTriple() (string, error) {
107
- // Use runtime.GOOS for the operating system and runtime.GOARCH for the architecture.
108
- switch runtime.GOOS {
109
- case "windows":
110
- switch runtime.GOARCH {
111
- case "386":
112
- return "i686-pc-windows-msvc", nil
113
- case "amd64":
114
- return "x86_64-pc-windows-msvc", nil
115
- case "arm64":
116
- return "aarch64-pc-windows-msvc", nil
117
- }
118
- case "darwin":
119
- switch runtime.GOARCH {
120
- case "amd64":
121
- return "x86_64-apple-darwin", nil
122
- case "arm64":
123
- return "aarch64-apple-darwin", nil
124
- }
125
- case "linux":
126
- switch runtime.GOARCH {
127
- case "386":
128
- return "i686-unknown-linux-gnu", nil
129
- case "amd64":
130
- return "x86_64-unknown-linux-gnu", nil
131
- case "arm":
132
- return "armv7-unknown-linux-gnueabihf", nil
133
- case "arm64":
134
- return "aarch64-unknown-linux-gnu", nil
135
- }
136
- }
137
-
138
- return "", fmt.Errorf("whoa there, this platform is not on the list: %s %s", runtime.GOOS, runtime.GOARCH)
139
- }
140
-
141
- func binName() string {
142
- var prefix, suffix = GetPrefixSuffix()
143
-
144
- return fmt.Sprintf("%sahqstore_cli_rs%s", prefix, suffix)
145
- }
146
-
147
- func getBinary() string {
148
- var dir, err = os.UserHomeDir()
149
-
150
- if err != nil {
151
- fmt.Println(err)
152
- os.Exit(1)
153
- }
154
-
155
- dir = path.Join(dir, "ahqstore-go")
156
-
157
- _, err = os.ReadDir(dir)
158
-
159
- if err != nil {
160
- os.MkdirAll(dir, os.ModePerm)
161
- }
162
-
163
- var file = path.Join(dir, binName())
164
-
165
- return file
166
- }
@@ -1,17 +0,0 @@
1
- //go:build darwin || freebsd || linux || netbsd
2
-
3
- package main
4
-
5
- import (
6
- "syscall"
7
-
8
- "github.com/ebitengine/purego"
9
- )
10
-
11
- func openLibrary(name string) (uintptr, error) {
12
- return purego.Dlopen(name, purego.RTLD_NOW|purego.RTLD_GLOBAL)
13
- }
14
-
15
- func unloadLibrary(library uintptr) {
16
- purego.Dlclose(syscall.Handle(library))
17
- }
@@ -1,16 +0,0 @@
1
- //go:build windows
2
-
3
- package main
4
-
5
- import "syscall"
6
-
7
- func openLibrary(name string) (uintptr, error) {
8
- // Use [syscall.LoadLibrary] here to avoid external dependencies (#270).
9
- // For actual use cases, [golang.org/x/sys/windows.NewLazySystemDLL] is recommended.
10
- handle, err := syscall.LoadLibrary(name)
11
- return uintptr(handle), err
12
- }
13
-
14
- func unloadLibrary(library uintptr) {
15
- syscall.FreeLibrary(syscall.Handle(library))
16
- }
package/go/go.mod DELETED
@@ -1,15 +0,0 @@
1
- module github.com/ahqstore
2
-
3
- go 1.25.1
4
-
5
- require (
6
- github.com/ebitengine/purego v0.8.4
7
- github.com/schollz/progressbar/v3 v3.18.0
8
- )
9
-
10
- require (
11
- github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
12
- github.com/rivo/uniseg v0.4.7 // indirect
13
- golang.org/x/sys v0.36.0 // indirect
14
- golang.org/x/term v0.35.0 // indirect
15
- )
package/go/go.sum DELETED
@@ -1,28 +0,0 @@
1
- github.com/chengxilo/virtualterm v1.0.4 h1:Z6IpERbRVlfB8WkOmtbHiDbBANU7cimRIof7mk9/PwM=
2
- github.com/chengxilo/virtualterm v1.0.4/go.mod h1:DyxxBZz/x1iqJjFxTFcr6/x+jSpqN0iwWCOK1q10rlY=
3
- github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4
- github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5
- github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw=
6
- github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
7
- github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
8
- github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
9
- github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
10
- github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
11
- github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
12
- github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
13
- github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
14
- github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
15
- github.com/schollz/progressbar/v3 v3.18.0 h1:uXdoHABRFmNIjUfte/Ex7WtuyVslrw2wVPQmCN62HpA=
16
- github.com/schollz/progressbar/v3 v3.18.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec=
17
- github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
18
- github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
19
- golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
20
- golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
21
- golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
22
- golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
23
- golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
24
- golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
25
- golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ=
26
- golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA=
27
- gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
28
- gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
@@ -1,4 +0,0 @@
1
- {
2
- "python-envs.defaultEnvManager": "ms-python.python:system",
3
- "python-envs.pythonProjects": []
4
- }
package/python/cli.py DELETED
@@ -1,124 +0,0 @@
1
- from cffi import FFI
2
- from pathlib import Path
3
- from requests import get
4
-
5
- import importlib.metadata
6
-
7
- import os
8
- import platform
9
- import sys
10
-
11
- ffi = FFI()
12
-
13
- ffi.cdef("""
14
- char* get_ver();
15
- void init_args();
16
- void add_arg(char*);
17
- void node_entrypoint(bool);
18
- """)
19
-
20
- ver = importlib.metadata.version("ahqstore-cli")
21
-
22
- def rust_target():
23
- os = platform.system().lower()
24
- arch = platform.machine().lower()
25
-
26
- if os == "windows":
27
- if arch == "i686":
28
- return "i686-pc-windows-msvc"
29
- elif arch in ("x86_64", "amd64"):
30
- return "x86_64-pc-windows-msvc"
31
- elif arch == "aarch64":
32
- return "aarch64-pc-windows-msvc"
33
- elif os == "darwin":
34
- if arch in ("x86_64", "amd64"):
35
- return "x86_64-apple-darwin"
36
- elif arch == "aarch64":
37
- return "aarch64-apple-darwin"
38
- elif os == "linux":
39
- if arch == "i686":
40
- return "i686-unknown-linux-gnu"
41
- elif arch in ("x86_64", "amd64"):
42
- return "x86_64-unknown-linux-gnu"
43
- elif arch == "armv7l":
44
- return "armv7-unknown-linux-gnueabihf"
45
- elif arch == "aarch64":
46
- return "aarch64-unknown-linux-gnu"
47
-
48
- # Error out for unsupported systems
49
- print(f"Error: Unsupported platform: {os} {arch}")
50
- sys.exit(1)
51
-
52
- def get_prefix_suffix():
53
- os = platform.system().lower()
54
- prefix = ""
55
- suffix = ""
56
-
57
- if os == "windows":
58
- suffix = ".dll"
59
- elif os == "darwin":
60
- prefix = "lib"
61
- suffix = ".dylib"
62
- elif os == "linux":
63
- prefix = "lib"
64
- suffix = ".so"
65
- else:
66
- # Default to a generic UNIX-like system
67
- prefix = "lib"
68
- suffix = ".so"
69
-
70
- return (prefix, suffix)
71
-
72
- def dlib():
73
- (prefix, suffix) = get_prefix_suffix()
74
-
75
- return f"{prefix}ahqstore_cli_rs{suffix}"
76
-
77
- dylib = Path.home().joinpath("ahqstore-py")
78
-
79
- if not dylib.exists():
80
- dylib.mkdir()
81
-
82
- dylib = dylib.joinpath(dlib())
83
-
84
- def dwnl():
85
- (prefix, suffix) = get_prefix_suffix()
86
-
87
- return f"https://github.com/ahqstore/cli/releases/download/{ver}/{prefix}ahqstore_cli_rs-{rust_target()}{suffix}"
88
-
89
- def dwn():
90
- url = dwnl()
91
-
92
- resp = get(url)
93
-
94
- resp.raise_for_status()
95
-
96
- with open(dylib, "wb") as f:
97
- f.write(resp.content)
98
-
99
- def main():
100
- C = None
101
-
102
- try:
103
- C = ffi.dlopen(str(dylib))
104
-
105
- ver_ptr = C.get_ver()
106
-
107
- version = ffi.string(ver_ptr)
108
-
109
- if not version == bytes(ver, "utf-8"):
110
- raise BufferError("This was an error comapring them")
111
- except:
112
- dwn()
113
- C = ffi.dlopen(str(dylib))
114
-
115
- C.init_args()
116
-
117
- for item in sys.argv[1:]:
118
- arg = ffi.new("char[]", bytes(item, "ascii"))
119
-
120
- C.add_arg(arg)
121
-
122
- C.node_entrypoint(
123
- os.environ.get("CI") == "true"
124
- )
@@ -1,27 +0,0 @@
1
- [build-system]
2
- requires = ["hatchling"]
3
- build-backend = "hatchling.build"
4
-
5
- [project]
6
- name = "ahqstore-cli"
7
- version = "0.10.2"
8
- authors = [{ name = "AHQ Softwares", email = "ahqsecret@gmail.com" }]
9
- description = "A modern Python wrapper for the ahqstore CLI"
10
- readme = "../README.md"
11
- requires-python = ">=3.8"
12
- classifiers = [
13
- "Programming Language :: Python :: 3",
14
- "License :: OSI Approved :: MIT License",
15
- "Operating System :: OS Independent",
16
- ]
17
- dependencies = [
18
- # List your Python dependencies here, e.g.,
19
- "requests>=2.25.1",
20
- "cffi>=1.17.0",
21
- ]
22
-
23
- [tool.hatch.build.targets.wheel]
24
- packages = ["."]
25
-
26
- [project.scripts]
27
- ahqstore = "cli:main"
package/python/setup.py DELETED
@@ -1,3 +0,0 @@
1
- import setuptools
2
-
3
- setuptools.setup()