kycli 0.0.0__tar.gz
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.
- kycli-0.0.0/MANIFEST.in +2 -0
- kycli-0.0.0/PKG-INFO +15 -0
- kycli-0.0.0/README.md +98 -0
- kycli-0.0.0/kycli/__init__.py +0 -0
- kycli-0.0.0/kycli/cli.py +56 -0
- kycli-0.0.0/kycli/kycore.c +11106 -0
- kycli-0.0.0/kycli/kycore.pyx +54 -0
- kycli-0.0.0/kycli.egg-info/PKG-INFO +15 -0
- kycli-0.0.0/kycli.egg-info/SOURCES.txt +13 -0
- kycli-0.0.0/kycli.egg-info/dependency_links.txt +1 -0
- kycli-0.0.0/kycli.egg-info/entry_points.txt +6 -0
- kycli-0.0.0/kycli.egg-info/top_level.txt +1 -0
- kycli-0.0.0/pyproject.toml +28 -0
- kycli-0.0.0/setup.cfg +4 -0
- kycli-0.0.0/setup.py +33 -0
kycli-0.0.0/MANIFEST.in
ADDED
kycli-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kycli
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: **kycli** is a high-performance Python CLI toolkit built with Cython for speed.
|
|
5
|
+
Author: Balakrishna Maduru
|
|
6
|
+
Author-email: balakrishnamaduru@gmail.com
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Cython
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: author-email
|
|
13
|
+
Dynamic: classifier
|
|
14
|
+
Dynamic: requires-python
|
|
15
|
+
Dynamic: summary
|
kycli-0.0.0/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# đ kycli â A Simple CLI Key-Value Store
|
|
2
|
+
|
|
3
|
+
`kycli` is a lightweight Python CLI utility to save, get, list, and delete key-value pairs directly from your terminal.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## đĻ Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install kycli
|
|
11
|
+
```
|
|
12
|
+
Or, clone and install locally:
|
|
13
|
+
```bash
|
|
14
|
+
git clone https://github.com/yourname/kycli.git
|
|
15
|
+
cd kycli
|
|
16
|
+
poetry install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
đ Usage
|
|
20
|
+
|
|
21
|
+
You can access the CLI using the following commands:
|
|
22
|
+
|
|
23
|
+
â
Save a value
|
|
24
|
+
```bash
|
|
25
|
+
kys <key> <value>
|
|
26
|
+
```
|
|
27
|
+
Example:
|
|
28
|
+
```bash
|
|
29
|
+
kys my_key "Hello, World!"
|
|
30
|
+
```
|
|
31
|
+
Output:
|
|
32
|
+
```
|
|
33
|
+
Saved: my_key
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
đĨ Get a value
|
|
37
|
+
```bash
|
|
38
|
+
kyg <key>
|
|
39
|
+
```
|
|
40
|
+
Example:
|
|
41
|
+
```bash
|
|
42
|
+
kyg my_key
|
|
43
|
+
```
|
|
44
|
+
Output:
|
|
45
|
+
```
|
|
46
|
+
Hello, World!
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
đ List all keys
|
|
50
|
+
```bash
|
|
51
|
+
kyl
|
|
52
|
+
```
|
|
53
|
+
Example:
|
|
54
|
+
```bash
|
|
55
|
+
kyl
|
|
56
|
+
```
|
|
57
|
+
Output:
|
|
58
|
+
```
|
|
59
|
+
Keys: my_key
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
â Delete a key
|
|
63
|
+
```bash
|
|
64
|
+
kyd <key>
|
|
65
|
+
```
|
|
66
|
+
Example:
|
|
67
|
+
```bash
|
|
68
|
+
kyd my_key
|
|
69
|
+
```
|
|
70
|
+
Output:
|
|
71
|
+
``` bash
|
|
72
|
+
Deleted
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
âšī¸ Help
|
|
76
|
+
```bash
|
|
77
|
+
kyh
|
|
78
|
+
```
|
|
79
|
+
Example:
|
|
80
|
+
```bash
|
|
81
|
+
kyh
|
|
82
|
+
```
|
|
83
|
+
Output:
|
|
84
|
+
```
|
|
85
|
+
Available commands:
|
|
86
|
+
kys <key> <value> - Save key-value
|
|
87
|
+
kyg <key> - Get value by key
|
|
88
|
+
kyl - List keys
|
|
89
|
+
kyd <key> - Delete key
|
|
90
|
+
kyh - Help
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Author
|
|
94
|
+
---
|
|
95
|
+
đ¤ Balakrishna Maduru
|
|
96
|
+
- [GitHub](https://github.com/balakrishna-maduru)
|
|
97
|
+
- [LinkedIn](https://www.linkedin.com/in/balakrishna-maduru)
|
|
98
|
+
- [Twitter](https://x.com/krishonlyyou)
|
|
File without changes
|
kycli-0.0.0/kycli/cli.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
import pickle
|
|
4
|
+
from kycli.kycore import Kycore
|
|
5
|
+
|
|
6
|
+
DATA_FILE = "kvdata.pkl"
|
|
7
|
+
|
|
8
|
+
def load_data(kv):
|
|
9
|
+
import os
|
|
10
|
+
if os.path.exists(kv.data_path) and os.path.getsize(kv.data_path) > 0:
|
|
11
|
+
with open(kv.data_path, "rb") as f:
|
|
12
|
+
store_data = pickle.load(f)
|
|
13
|
+
kv.load_store(store_data)
|
|
14
|
+
|
|
15
|
+
def save_data(kv):
|
|
16
|
+
with open(DATA_FILE, "wb") as f:
|
|
17
|
+
pickle.dump(kv.store, f)
|
|
18
|
+
|
|
19
|
+
def print_help():
|
|
20
|
+
print("""
|
|
21
|
+
Available commands:
|
|
22
|
+
kys <key> <value> - Save key-value
|
|
23
|
+
kyg <key> - Get value by key
|
|
24
|
+
kyl - List keys
|
|
25
|
+
kyd <key> - Delete key
|
|
26
|
+
kyh - Help
|
|
27
|
+
""")
|
|
28
|
+
|
|
29
|
+
def main():
|
|
30
|
+
kv = Kycore()
|
|
31
|
+
load_data(kv)
|
|
32
|
+
|
|
33
|
+
args = sys.argv[1:]
|
|
34
|
+
prog = os.path.basename(sys.argv[0])
|
|
35
|
+
|
|
36
|
+
if prog in ["kys", "save"] and len(args) == 2:
|
|
37
|
+
kv.save(args[0], args[1])
|
|
38
|
+
save_data(kv)
|
|
39
|
+
print(f"Saved: {args[0]}")
|
|
40
|
+
|
|
41
|
+
elif prog in ["kyg", "getkey"] and len(args) == 1:
|
|
42
|
+
print(kv.getkey(args[0]))
|
|
43
|
+
|
|
44
|
+
elif prog in ["kyd", "delete"] and len(args) == 1:
|
|
45
|
+
print(kv.delete(args[0]))
|
|
46
|
+
save_data(kv)
|
|
47
|
+
|
|
48
|
+
elif prog in ["kyl", "listkeys"]:
|
|
49
|
+
print("Keys:", ", ".join(kv.listkeys()))
|
|
50
|
+
|
|
51
|
+
elif prog in ["kyh", "help"]:
|
|
52
|
+
print_help()
|
|
53
|
+
|
|
54
|
+
else:
|
|
55
|
+
print("Invalid command or arguments.")
|
|
56
|
+
print_help()
|