cli-ih 0.5.1__tar.gz → 0.5.2__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.
@@ -28,10 +28,11 @@ def setup_logging():
28
28
 
29
29
  class InputHandler:
30
30
  #logging.basicConfig(level=logging.INFO, format='[%(asctime)s | %(levelname)s]: %(message)s', datefmt='%B %d %H:%M:%S')
31
- def __init__(self, thread_mode = True):
31
+ def __init__(self, thread_mode = True, cursor = ""):
32
32
  self.commands = {}
33
33
  self.is_running = False
34
34
  self.thread_mode = thread_mode
35
+ self.cursor = f"{cursor.strip()} "
35
36
  self.thread = None
36
37
  self.register_default_commands()
37
38
 
@@ -70,7 +71,7 @@ class InputHandler:
70
71
  """Continuously listens for user input and processes commands."""
71
72
  while self.is_running:
72
73
  try:
73
- user_input = input().strip()
74
+ user_input = input(self.cursor).strip()
74
75
  if not user_input:
75
76
  continue
76
77
 
cli_ih-0.5.2/PKG-INFO ADDED
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.1
2
+ Name: cli_ih
3
+ Version: 0.5.2
4
+ Summary: A background command handler for python's command line interface.
5
+ Author-email: Hotment <michatchuplay@gmail.com>
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+
9
+ # InputHandler Library
10
+
11
+ A lightweight Python library for creating interactive command-line interfaces with custom command registration and input handling. It supports threaded input processing and includes enhanced logging with color-coded output.
12
+
13
+ ## Features
14
+
15
+ - Command registration system with descriptions
16
+ - Threaded or non-threaded input handling
17
+ - Colored logging with support for debug mode
18
+ - Built-in `help`, `debug`, and `exit` commands
19
+ - Error handling for missing or invalid command arguments
20
+
21
+ ## Installation
22
+
23
+ pip install cli-ih
24
+
25
+ ## Quick Start
26
+
27
+ ```python
28
+ from cli-ih import InputHandler
29
+
30
+ def greet(args):
31
+ print(f"Hello, {' '.join(args)}!")
32
+
33
+ handler = InputHandler()
34
+ handler.register_command("greet", greet, "Greets the user. Usage: greet [name]")
35
+ handler.start()
36
+
37
+ # Now type commands like:
38
+ # > greet world
39
+ # > help
40
+ # > debug
41
+ # > exit
42
+ ```
43
+
44
+ ## Additional Info
45
+
46
+ - You can also import the `logging` module from `cli-ih` to use the same config as the module
47
+ - You can provide the `thread_mode` param to the `InputHandler` class to set if it shoud run in a thread or no.
48
+ (If you are using the `cli-ih` module on its own without any other background task set `thread_mode=False` to false)
49
+ - You can also provide a `cursor` param to the `InputHandler` class to set the cli cursor (default cusor is empty)
cli_ih-0.5.2/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # InputHandler Library
2
+
3
+ A lightweight Python library for creating interactive command-line interfaces with custom command registration and input handling. It supports threaded input processing and includes enhanced logging with color-coded output.
4
+
5
+ ## Features
6
+
7
+ - Command registration system with descriptions
8
+ - Threaded or non-threaded input handling
9
+ - Colored logging with support for debug mode
10
+ - Built-in `help`, `debug`, and `exit` commands
11
+ - Error handling for missing or invalid command arguments
12
+
13
+ ## Installation
14
+
15
+ pip install cli-ih
16
+
17
+ ## Quick Start
18
+
19
+ ```python
20
+ from cli-ih import InputHandler
21
+
22
+ def greet(args):
23
+ print(f"Hello, {' '.join(args)}!")
24
+
25
+ handler = InputHandler()
26
+ handler.register_command("greet", greet, "Greets the user. Usage: greet [name]")
27
+ handler.start()
28
+
29
+ # Now type commands like:
30
+ # > greet world
31
+ # > help
32
+ # > debug
33
+ # > exit
34
+ ```
35
+
36
+ ## Additional Info
37
+
38
+ - You can also import the `logging` module from `cli-ih` to use the same config as the module
39
+ - You can provide the `thread_mode` param to the `InputHandler` class to set if it shoud run in a thread or no.
40
+ (If you are using the `cli-ih` module on its own without any other background task set `thread_mode=False` to false)
41
+ - You can also provide a `cursor` param to the `InputHandler` class to set the cli cursor (default cusor is empty)
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.1
2
+ Name: cli_ih
3
+ Version: 0.5.2
4
+ Summary: A background command handler for python's command line interface.
5
+ Author-email: Hotment <michatchuplay@gmail.com>
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+
9
+ # InputHandler Library
10
+
11
+ A lightweight Python library for creating interactive command-line interfaces with custom command registration and input handling. It supports threaded input processing and includes enhanced logging with color-coded output.
12
+
13
+ ## Features
14
+
15
+ - Command registration system with descriptions
16
+ - Threaded or non-threaded input handling
17
+ - Colored logging with support for debug mode
18
+ - Built-in `help`, `debug`, and `exit` commands
19
+ - Error handling for missing or invalid command arguments
20
+
21
+ ## Installation
22
+
23
+ pip install cli-ih
24
+
25
+ ## Quick Start
26
+
27
+ ```python
28
+ from cli-ih import InputHandler
29
+
30
+ def greet(args):
31
+ print(f"Hello, {' '.join(args)}!")
32
+
33
+ handler = InputHandler()
34
+ handler.register_command("greet", greet, "Greets the user. Usage: greet [name]")
35
+ handler.start()
36
+
37
+ # Now type commands like:
38
+ # > greet world
39
+ # > help
40
+ # > debug
41
+ # > exit
42
+ ```
43
+
44
+ ## Additional Info
45
+
46
+ - You can also import the `logging` module from `cli-ih` to use the same config as the module
47
+ - You can provide the `thread_mode` param to the `InputHandler` class to set if it shoud run in a thread or no.
48
+ (If you are using the `cli-ih` module on its own without any other background task set `thread_mode=False` to false)
49
+ - You can also provide a `cursor` param to the `InputHandler` class to set the cli cursor (default cusor is empty)
@@ -5,5 +5,4 @@ InputHandler/__init__.py
5
5
  cli_ih.egg-info/PKG-INFO
6
6
  cli_ih.egg-info/SOURCES.txt
7
7
  cli_ih.egg-info/dependency_links.txt
8
- cli_ih.egg-info/requires.txt
9
8
  cli_ih.egg-info/top_level.txt
@@ -1,11 +1,8 @@
1
1
  [project]
2
2
  name = "cli_ih"
3
- version = "0.5.1"
3
+ version = "0.5.2"
4
4
  description = "A background command handler for python's command line interface."
5
- # readme = "README.md"
6
- dependencies=[
7
- 'logging==0.4.9.6'
8
- ]
5
+ readme = "README.md"
9
6
  requires-python = ">= 3.8"
10
7
  authors = [
11
8
  {name = "Hotment", email = "michatchuplay@gmail.com"}
cli_ih-0.5.2/setup.py ADDED
@@ -0,0 +1,15 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ with open("README.md", "r") as f:
4
+ description = f.read()
5
+
6
+ setup(
7
+ name="cli_ih",
8
+ version = "0.5.2",
9
+ packages=find_packages(),
10
+ install_requires = [
11
+ 'logging>=0.4.9.6'
12
+ ],
13
+ long_description=description,
14
+ long_description_content_type="text/markdown"
15
+ )
cli_ih-0.5.1/PKG-INFO DELETED
@@ -1,7 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: cli_ih
3
- Version: 0.5.1
4
- Summary: A background command handler for python's command line interface.
5
- Author-email: Hotment <michatchuplay@gmail.com>
6
- Requires-Python: >=3.8
7
- Requires-Dist: logging==0.4.9.6
cli_ih-0.5.1/README.md DELETED
File without changes
@@ -1,7 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: cli_ih
3
- Version: 0.5.1
4
- Summary: A background command handler for python's command line interface.
5
- Author-email: Hotment <michatchuplay@gmail.com>
6
- Requires-Python: >=3.8
7
- Requires-Dist: logging==0.4.9.6
@@ -1 +0,0 @@
1
- logging==0.4.9.6
cli_ih-0.5.1/setup.py DELETED
@@ -1,11 +0,0 @@
1
- from setuptools import setup, find_packages
2
-
3
-
4
- setup(
5
- name="cli_ih",
6
- version = "0.5.1",
7
- packages=find_packages(),
8
- install_requires = [
9
- 'logging==0.4.9.6'
10
- ]
11
- )
File without changes