pStar-cli 1.0.0__tar.gz → 1.0.3__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.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pStar-cli
3
- Version: 1.0.0
4
- Summary: Pustil terminal client for findlo.ir
3
+ Version: 1.0.3
4
+ Summary: A powerful CLI tool with multiple commands
5
5
  Home-page: https://github.com/Findlo/pustil
6
6
  Author: Eliot Sterling
7
7
  Author-email: itseliot0x@gmail.com
@@ -10,15 +10,12 @@ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.6
12
12
  Description-Content-Type: text/markdown
13
- Requires-Dist: python-socketio[client]
14
- Requires-Dist: websocket-client
15
13
  Dynamic: author
16
14
  Dynamic: author-email
17
15
  Dynamic: classifier
18
16
  Dynamic: description
19
17
  Dynamic: description-content-type
20
18
  Dynamic: home-page
21
- Dynamic: requires-dist
22
19
  Dynamic: requires-python
23
20
  Dynamic: summary
24
21
 
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pStar-cli
3
- Version: 1.0.0
4
- Summary: Pustil terminal client for findlo.ir
3
+ Version: 1.0.3
4
+ Summary: A powerful CLI tool with multiple commands
5
5
  Home-page: https://github.com/Findlo/pustil
6
6
  Author: Eliot Sterling
7
7
  Author-email: itseliot0x@gmail.com
@@ -10,15 +10,12 @@ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.6
12
12
  Description-Content-Type: text/markdown
13
- Requires-Dist: python-socketio[client]
14
- Requires-Dist: websocket-client
15
13
  Dynamic: author
16
14
  Dynamic: author-email
17
15
  Dynamic: classifier
18
16
  Dynamic: description
19
17
  Dynamic: description-content-type
20
18
  Dynamic: home-page
21
- Dynamic: requires-dist
22
19
  Dynamic: requires-python
23
20
  Dynamic: summary
24
21
 
@@ -6,7 +6,6 @@ pStar_cli.egg-info/PKG-INFO
6
6
  pStar_cli.egg-info/SOURCES.txt
7
7
  pStar_cli.egg-info/dependency_links.txt
8
8
  pStar_cli.egg-info/entry_points.txt
9
- pStar_cli.egg-info/requires.txt
10
9
  pStar_cli.egg-info/top_level.txt
11
10
  pustil/__init__.py
12
11
  pustil/__main__.py
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ PStar = pustil.client:main
3
+ PStar-cli = pustil.client:main
4
+ Pustil = pustil.client:main
5
+ Star = pustil.client:main
@@ -0,0 +1,279 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ import sys
5
+ import os
6
+ import time
7
+ import getpass
8
+ import json
9
+ from datetime import datetime
10
+ from pathlib import Path
11
+
12
+ # ============ رنگ‌های ANSI ============
13
+ class Colors:
14
+ HEADER = '\033[95m'
15
+ BLUE = '\033[94m'
16
+ CYAN = '\033[96m'
17
+ GREEN = '\033[92m'
18
+ YELLOW = '\033[93m'
19
+ RED = '\033[91m'
20
+ BOLD = '\033[1m'
21
+ UNDERLINE = '\033[4m'
22
+ END = '\033[0m'
23
+
24
+ # ============ لوگوها ============
25
+ LOGOS = {
26
+ "Pustil": f"""
27
+ {Colors.CYAN}╔═══════════════════════════════════════╗
28
+ ║ {Colors.BOLD}P U S T I L{Colors.END}{Colors.CYAN} - Main Engine ║
29
+ ╚═══════════════════════════════════════╝{Colors.END}
30
+ """,
31
+ "PStar": f"""
32
+ {Colors.YELLOW}╔═══════════════════════════════════════╗
33
+ ║ {Colors.BOLD}⭐ P S T A R ⭐{Colors.END}{Colors.YELLOW} - Premium CLI ║
34
+ ╚═══════════════════════════════════════╝{Colors.END}
35
+ """,
36
+ "PStar-cli": f"""
37
+ {Colors.GREEN}╔═══════════════════════════════════════╗
38
+ ║ {Colors.BOLD}🚀 P S T A R - C L I{Colors.END}{Colors.GREEN} - Turbo Mode ║
39
+ ╚═══════════════════════════════════════╝{Colors.END}
40
+ """,
41
+ "Star": f"""
42
+ {Colors.RED}╔═══════════════════════════════════════╗
43
+ ║ {Colors.BOLD}🌟 S T A R (Coming Soon){Colors.END}{Colors.RED} ║
44
+ ╚═══════════════════════════════════════╝{Colors.END}
45
+ """
46
+ }
47
+
48
+ VERSION = "1.2.0"
49
+ TOKEN_FILE = Path.home() / ".pustil_token"
50
+
51
+ # ============ مدیریت توکن ============
52
+ def save_token(username, token):
53
+ """ذخیره‌ی توکن در فایل"""
54
+ data = {"username": username, "token": token, "timestamp": datetime.now().isoformat()}
55
+ with open(TOKEN_FILE, "w") as f:
56
+ json.dump(data, f)
57
+ os.chmod(TOKEN_FILE, 0o600) # فقط خود کاربر بخونه
58
+
59
+ def load_token():
60
+ """بارگذاری توکن از فایل"""
61
+ if TOKEN_FILE.exists():
62
+ with open(TOKEN_FILE, "r") as f:
63
+ return json.load(f)
64
+ return None
65
+
66
+ def clear_token():
67
+ """پاک کردن توکن (logout)"""
68
+ if TOKEN_FILE.exists():
69
+ TOKEN_FILE.unlink()
70
+
71
+ # ============ توابع اصلی ============
72
+ def print_logo(command_name):
73
+ logo = LOGOS.get(command_name, LOGOS["Pustil"])
74
+ print(logo)
75
+
76
+ def show_help(command_name):
77
+ print(f"{Colors.BOLD}{Colors.CYAN}📖 Help for {command_name}{Colors.END}")
78
+ print(f"{Colors.YELLOW}Usage:{Colors.END} {command_name} [OPTIONS] [COMMAND]")
79
+ print()
80
+ print(f"{Colors.GREEN}Commands:{Colors.END}")
81
+ print(f" {Colors.BOLD}init{Colors.END} Initialize a new project")
82
+ print(f" {Colors.BOLD}run{Colors.END} Run the main process")
83
+ print(f" {Colors.BOLD}config{Colors.END} Show or edit configuration")
84
+ print(f" {Colors.BOLD}login{Colors.END} Login to your account")
85
+ print(f" {Colors.BOLD}logout{Colors.END} Logout from your account")
86
+ print(f" {Colors.BOLD}status{Colors.END} Show login status")
87
+ print(f" {Colors.BOLD}shell{Colors.END} Enter interactive shell")
88
+ print(f" {Colors.BOLD}version{Colors.END} Show version info")
89
+ print()
90
+ print(f"{Colors.GREEN}Options:{Colors.END}")
91
+ print(f" {Colors.BOLD}--help{Colors.END} Show this help message")
92
+ print(f" {Colors.BOLD}--version{Colors.END} Show version number")
93
+ print(f" {Colors.BOLD}--verbose{Colors.END} Enable verbose output")
94
+ print()
95
+ print(f"{Colors.YELLOW}Example:{Colors.END}")
96
+ print(f" {command_name} login")
97
+ print(f" {command_name} init --name MyProject")
98
+
99
+ def show_version():
100
+ print(f"{Colors.BOLD}{Colors.GREEN}pStar CLI v{VERSION}{Colors.END}")
101
+ print(f"{Colors.CYAN}Released: 2026-06-27{Colors.END}")
102
+ print(f"{Colors.YELLOW}✨ Built with ❤️ in Termux{Colors.END}")
103
+
104
+ def star_coming_soon():
105
+ print(f"{Colors.RED}╔═════════════════════════════════════════════╗{Colors.END}")
106
+ print(f"{Colors.RED}║ {Colors.BOLD}{Colors.YELLOW}⭐ STAR MODE ⭐{Colors.END}{Colors.RED} {Colors.BOLD}Coming Soon in v2.0.0{Colors.END}{Colors.RED} ║{Colors.END}")
107
+ print(f"{Colors.RED}╚═════════════════════════════════════════════╝{Colors.END}")
108
+ print()
109
+ print(f"{Colors.CYAN}🚀 We're building something amazing...{Colors.END}")
110
+ print(f"{Colors.YELLOW}🔥 Stay tuned for:{Colors.END}")
111
+ print(f" • {Colors.GREEN}AI-powered features{Colors.END}")
112
+ print(f" • {Colors.GREEN}Cloud synchronization{Colors.END}")
113
+ print(f" • {Colors.GREEN}Plugin system{Colors.END}")
114
+ print()
115
+ print(f"{Colors.BOLD}{Colors.BLUE}✨ Follow us on GitHub for updates! ✨{Colors.END}")
116
+
117
+ def cmd_login():
118
+ """زیردستور login - ورود به حساب"""
119
+ print(f"{Colors.BLUE}🔐 Login to pStar{Colors.END}")
120
+ username = input(f"{Colors.CYAN}👤 Username: {Colors.END}")
121
+ password = getpass.getpass(f"{Colors.CYAN}🔑 Password: {Colors.END}")
122
+
123
+ # شبیه‌سازی احراز هویت (اینجا می‌تونی API واقعی وصل کنی)
124
+ if username and password:
125
+ # توکن ساختگی (در عمل از سرور دریافت میشه)
126
+ fake_token = f"pstar_{username}_{int(time.time())}"
127
+ save_token(username, fake_token)
128
+ print(f"{Colors.GREEN}✅ Login successful! Welcome back, {Colors.BOLD}{username}{Colors.END}{Colors.GREEN}! 🎉{Colors.END}")
129
+ print(f"{Colors.YELLOW}💡 Your session token: {fake_token[:20]}...{Colors.END}")
130
+ else:
131
+ print(f"{Colors.RED}❌ Username and password cannot be empty!{Colors.END}")
132
+
133
+ def cmd_logout():
134
+ """زیردستور logout - خروج از حساب"""
135
+ token_data = load_token()
136
+ if token_data:
137
+ clear_token()
138
+ print(f"{Colors.GREEN}👋 Logged out successfully. Goodbye, {Colors.BOLD}{token_data.get('username', 'User')}{Colors.END}{Colors.GREEN}!{Colors.END}")
139
+ else:
140
+ print(f"{Colors.YELLOW}⚠️ You are not logged in.{Colors.END}")
141
+
142
+ def cmd_status():
143
+ """زیردستور status - نمایش وضعیت"""
144
+ token_data = load_token()
145
+ if token_data:
146
+ print(f"{Colors.GREEN}✅ You are logged in as {Colors.BOLD}{token_data['username']}{Colors.END}")
147
+ print(f"{Colors.CYAN}📅 Session started: {token_data.get('timestamp', 'Unknown')}{Colors.END}")
148
+ print(f"{Colors.YELLOW}🔑 Token: {token_data['token'][:20]}...{Colors.END}")
149
+ else:
150
+ print(f"{Colors.RED}❌ You are not logged in. Please run: {Colors.BOLD}Pustil login{Colors.END}")
151
+
152
+ def interactive_shell():
153
+ """حالت تعاملی (shell)"""
154
+ print(f"{Colors.BOLD}{Colors.CYAN}🚀 pStar Interactive Shell (type 'exit' to quit){Colors.END}")
155
+ print(f"{Colors.YELLOW}💡 Available commands: login, logout, status, help, exit{Colors.END}")
156
+
157
+ while True:
158
+ try:
159
+ cmd = input(f"{Colors.GREEN}pstar> {Colors.END}").strip()
160
+ if not cmd:
161
+ continue
162
+ if cmd.lower() in ["exit", "quit", "q"]:
163
+ print(f"{Colors.CYAN}👋 Goodbye!{Colors.END}")
164
+ break
165
+ elif cmd == "login":
166
+ cmd_login()
167
+ elif cmd == "logout":
168
+ cmd_logout()
169
+ elif cmd == "status":
170
+ cmd_status()
171
+ elif cmd == "help":
172
+ print(f"{Colors.YELLOW}Commands: login, logout, status, help, exit{Colors.END}")
173
+ else:
174
+ print(f"{Colors.RED}❌ Unknown command: {cmd}{Colors.END}")
175
+ except KeyboardInterrupt:
176
+ print(f"\n{Colors.CYAN}👋 Goodbye!{Colors.END}")
177
+ break
178
+
179
+ def run_subcommand(command_name, args):
180
+ """اجرای زیردستورات"""
181
+ if len(args) == 0:
182
+ # بدون زیردستور => پیشنهاد ورود یا shell
183
+ token_data = load_token()
184
+ if token_data:
185
+ print(f"{Colors.GREEN}✅ Welcome back, {Colors.BOLD}{token_data['username']}{Colors.END}{Colors.GREEN}!{Colors.END}")
186
+ print(f"{Colors.YELLOW}💡 Type '{command_name} shell' for interactive mode{Colors.END}")
187
+ else:
188
+ print(f"{Colors.GREEN}✅ {command_name} is ready!{Colors.END}")
189
+ print(f"{Colors.YELLOW}💡 Try: {command_name} login or {command_name} --help{Colors.END}")
190
+ return
191
+
192
+ subcommand = args[0]
193
+
194
+ if subcommand == "init":
195
+ print(f"{Colors.BLUE}🔧 Initializing new project...{Colors.END}")
196
+ time.sleep(1)
197
+ print(f"{Colors.GREEN}✅ Project initialized successfully!{Colors.END}")
198
+
199
+ elif subcommand == "run":
200
+ print(f"{Colors.GREEN}🏃 Running {command_name}...{Colors.END}")
201
+ time.sleep(1)
202
+ print(f"{Colors.CYAN}⚡ Processing...{Colors.END}")
203
+ time.sleep(1)
204
+ print(f"{Colors.GREEN}✅ Done!{Colors.END}")
205
+
206
+ elif subcommand == "config":
207
+ print(f"{Colors.YELLOW}⚙️ Current configuration:{Colors.END}")
208
+ print(f" • Mode: {Colors.GREEN}production{Colors.END}")
209
+ print(f" • Log Level: {Colors.GREEN}INFO{Colors.END}")
210
+ print(f" • Timeout: {Colors.GREEN}30s{Colors.END}")
211
+
212
+ elif subcommand == "login":
213
+ cmd_login()
214
+
215
+ elif subcommand == "logout":
216
+ cmd_logout()
217
+
218
+ elif subcommand == "status":
219
+ cmd_status()
220
+
221
+ elif subcommand == "shell":
222
+ interactive_shell()
223
+
224
+ elif subcommand == "version":
225
+ show_version()
226
+
227
+ else:
228
+ print(f"{Colors.RED}❌ Unknown subcommand: {subcommand}{Colors.END}")
229
+ print(f"{Colors.YELLOW}💡 Try: {command_name} --help{Colors.END}")
230
+
231
+ # ============ تابع اصلی ============
232
+ def main():
233
+ command_name = os.path.basename(sys.argv[0])
234
+ args = sys.argv[1:]
235
+
236
+ # بررسی آرگومان‌های عمومی
237
+ if "--help" in args or "-h" in args:
238
+ show_help(command_name)
239
+ return
240
+
241
+ if "--version" in args or "-v" in args:
242
+ show_version()
243
+ return
244
+
245
+ # چاپ لوگو
246
+ print_logo(command_name)
247
+ time.sleep(0.3)
248
+
249
+ # دستور Star
250
+ if command_name == "Star":
251
+ star_coming_soon()
252
+ return
253
+
254
+ # حذف آرگومان‌های عمومی
255
+ filtered_args = [arg for arg in args if arg not in ["--verbose"]]
256
+
257
+ if "--verbose" in args:
258
+ print(f"{Colors.CYAN}🔍 Verbose mode enabled{Colors.END}")
259
+ print(f"{Colors.YELLOW}📋 Command: {command_name}{Colors.END}")
260
+ print(f"{Colors.YELLOW}📋 Arguments: {filtered_args}{Colors.END}")
261
+ print()
262
+
263
+ # اجرای زیردستور
264
+ run_subcommand(command_name, filtered_args)
265
+
266
+ # خط جداکننده
267
+ print()
268
+ print(f"{Colors.BOLD}{Colors.BLUE}━" * 50 + f"{Colors.END}")
269
+ print(f"{Colors.CYAN}✨ Powered by pStar Engine v{VERSION}{Colors.END}")
270
+
271
+ if __name__ == "__main__":
272
+ try:
273
+ main()
274
+ except KeyboardInterrupt:
275
+ print(f"\n{Colors.YELLOW}⚠️ Interrupted by user. Goodbye!{Colors.END}")
276
+ sys.exit(0)
277
+ except Exception as e:
278
+ print(f"{Colors.RED}❌ Error: {e}{Colors.END}")
279
+ sys.exit(1)
@@ -5,10 +5,10 @@ with open("README.md", "r", encoding="utf-8") as fh:
5
5
 
6
6
  setup(
7
7
  name="pStar-cli",
8
- version="1.0.0",
8
+ version="1.0.3",
9
9
  author="Eliot Sterling",
10
10
  author_email="itseliot0x@gmail.com",
11
- description="Pustil terminal client for findlo.ir",
11
+ description="A powerful CLI tool with multiple commands",
12
12
  long_description=long_description,
13
13
  long_description_content_type="text/markdown",
14
14
  url="https://github.com/Findlo/pustil",
@@ -18,14 +18,13 @@ setup(
18
18
  "License :: OSI Approved :: MIT License",
19
19
  "Operating System :: OS Independent",
20
20
  ],
21
- python_requires=">=3.6",
22
- install_requires=[
23
- "python-socketio[client]",
24
- "websocket-client"
25
- ],
21
+ python_requires='>=3.6',
26
22
  entry_points={
27
- "console_scripts": [
28
- "pustil = pustil.client:main",
23
+ 'console_scripts': [
24
+ 'Pustil=pustil.client:main',
25
+ 'PStar=pustil.client:main',
26
+ 'PStar-cli=pustil.client:main',
27
+ 'Star=pustil.client:main',
29
28
  ],
30
29
  },
31
30
  )
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- pustil = pustil.client:main
@@ -1,2 +0,0 @@
1
- python-socketio[client]
2
- websocket-client
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes