make-selection 1.0.6__tar.gz → 1.0.7__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.
- {make_selection-1.0.6 → make_selection-1.0.7}/PKG-INFO +3 -2
- {make_selection-1.0.6 → make_selection-1.0.7}/pyproject.toml +1 -1
- {make_selection-1.0.6 → make_selection-1.0.7}/src/make_selection/make_selection.py +14 -14
- {make_selection-1.0.6 → make_selection-1.0.7}/src/make_selection.egg-info/PKG-INFO +3 -2
- {make_selection-1.0.6 → make_selection-1.0.7}/LICENSE +0 -0
- {make_selection-1.0.6 → make_selection-1.0.7}/README.md +0 -0
- {make_selection-1.0.6 → make_selection-1.0.7}/setup.cfg +0 -0
- {make_selection-1.0.6 → make_selection-1.0.7}/src/make_selection/__init__.py +0 -0
- {make_selection-1.0.6 → make_selection-1.0.7}/src/make_selection.egg-info/SOURCES.txt +0 -0
- {make_selection-1.0.6 → make_selection-1.0.7}/src/make_selection.egg-info/dependency_links.txt +0 -0
- {make_selection-1.0.6 → make_selection-1.0.7}/src/make_selection.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: make_selection
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: Package for interactive command line menu
|
|
5
5
|
Author-email: Steven Frazee <stevefrazee123@gmail.com>
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -10,6 +10,7 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
10
10
|
Requires-Python: >=3.9
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
|
+
Dynamic: license-file
|
|
13
14
|
|
|
14
15
|
<p align="center">
|
|
15
16
|
<img src="https://github.com/steve3424/make_selection/blob/main/images/logo.png?raw=true" alt="Make selection logo">
|
|
@@ -105,13 +105,13 @@ class Menu:
|
|
|
105
105
|
char = chr(char)
|
|
106
106
|
self.search_string = f"{self.search_string}{char}".lstrip()
|
|
107
107
|
if self.search_string:
|
|
108
|
-
print(char, end="", flush=True)
|
|
108
|
+
print(char, end="", flush=True, file=sys.stderr)
|
|
109
109
|
self.search(self.options_current)
|
|
110
110
|
something_changed = True
|
|
111
111
|
elif char == BACKSPACE and 0 < len(self.search_string):
|
|
112
112
|
self.search_string = self.search_string[:-1]
|
|
113
113
|
# NOTE: Move left once ([1D), print space, move left again
|
|
114
|
-
print("\x1b[1D \x1b[1D", end="", flush=True)
|
|
114
|
+
print("\x1b[1D \x1b[1D", end="", flush=True, file=sys.stderr)
|
|
115
115
|
self.search(self.options_original)
|
|
116
116
|
something_changed = True
|
|
117
117
|
elif char == ENTER_KEY and self.options_current:
|
|
@@ -123,7 +123,7 @@ class Menu:
|
|
|
123
123
|
return self.options_current[self.selected_index].value
|
|
124
124
|
elif char == CTL_C:
|
|
125
125
|
self.clearMenu()
|
|
126
|
-
print("cancelled")
|
|
126
|
+
print("cancelled", file=sys.stderr)
|
|
127
127
|
return None
|
|
128
128
|
|
|
129
129
|
if something_changed:
|
|
@@ -196,7 +196,7 @@ class Menu:
|
|
|
196
196
|
[0G move cursor to column 0.
|
|
197
197
|
[J clears to end of screen (not end of line).
|
|
198
198
|
"""
|
|
199
|
-
print("\x1b[0G\x1b[J", end="", flush=True)
|
|
199
|
+
print("\x1b[0G\x1b[J", end="", flush=True, file=sys.stderr)
|
|
200
200
|
|
|
201
201
|
def printMenu(self):
|
|
202
202
|
header = f"{ANSI_BLUE}{self.label}>{ANSI_RESET}{self.search_string}"
|
|
@@ -204,11 +204,11 @@ class Menu:
|
|
|
204
204
|
if self.mode == Mode.MULTI_SELECT:
|
|
205
205
|
header += f"\n{ANSI_GREEN}{len(self.options_selected)} items selected!{ANSI_RESET}"
|
|
206
206
|
header_num_lines = 2
|
|
207
|
-
print(header)
|
|
207
|
+
print(header, file=sys.stderr)
|
|
208
208
|
|
|
209
209
|
bottom = self.window_top + self.window_size_current
|
|
210
210
|
if not self.options_current:
|
|
211
|
-
print(f"{ANSI_BLUE}no matches found{ANSI_RESET}")
|
|
211
|
+
print(f"{ANSI_BLUE}no matches found{ANSI_RESET}", file=sys.stderr)
|
|
212
212
|
# NOTE: window size is 0 here after empty search, but we are printing 1 line
|
|
213
213
|
# so we need to set it so the footer prints correctly
|
|
214
214
|
self.window_size_current = 1
|
|
@@ -224,23 +224,23 @@ class Menu:
|
|
|
224
224
|
option_to_print = f"{ANSI_HIGHLIGHT}{opt_beg}{ANSI_HIGHLIGHT_SEARCH_STRING}{opt_mid}{ANSI_HIGHLIGHT}{opt_end}{ANSI_RESET}"
|
|
225
225
|
else:
|
|
226
226
|
option_to_print = f"{opt_beg}{ANSI_MAGENTA}{opt_mid}{ANSI_RESET}{opt_end}"
|
|
227
|
-
print(option_to_print)
|
|
227
|
+
print(option_to_print, file=sys.stderr)
|
|
228
228
|
|
|
229
229
|
footer = f"{ANSI_YELLOW}{self.help_string}{ANSI_RESET}\n"
|
|
230
230
|
footer_num_lines = 1
|
|
231
|
-
print(f"{footer}{ANSI_MOVE_CURSOR.format(up=self.window_size_current + header_num_lines + footer_num_lines, right=len(self.label) + len(self.search_string) + 1)}", end="", flush=True)
|
|
231
|
+
print(f"{footer}{ANSI_MOVE_CURSOR.format(up=self.window_size_current + header_num_lines + footer_num_lines, right=len(self.label) + len(self.search_string) + 1)}", end="", flush=True, file=sys.stderr)
|
|
232
232
|
|
|
233
233
|
def printSelected(self):
|
|
234
234
|
self.clearMenu()
|
|
235
235
|
if self.mode == Mode.MULTI_SELECT:
|
|
236
236
|
if len(self.options_selected) == 0:
|
|
237
|
-
print(f"{self.label}> (0 items) []")
|
|
237
|
+
print(f"{self.label}> (0 items) []", file=sys.stderr)
|
|
238
238
|
elif len(self.options_selected) == 1:
|
|
239
|
-
print(f"{self.label}> (1 item) {self.multiSelectGetValues(self.options_selected)}")
|
|
239
|
+
print(f"{self.label}> (1 item) {self.multiSelectGetValues(self.options_selected)}", file=sys.stderr)
|
|
240
240
|
else:
|
|
241
|
-
print(f"{self.label}> ({len(self.options_selected)} items) [{self.options_selected[0].value}, ...]")
|
|
241
|
+
print(f"{self.label}> ({len(self.options_selected)} items) [{self.options_selected[0].value}, ...]", file=sys.stderr)
|
|
242
242
|
else:
|
|
243
|
-
print(f"{self.label}> {self.options_current[self.selected_index].value}")
|
|
243
|
+
print(f"{self.label}> {self.options_current[self.selected_index].value}", file=sys.stderr)
|
|
244
244
|
|
|
245
245
|
def makeSelection(options: list[Any], label: str, window_size: int=None, multi_select: bool=False) -> Any:
|
|
246
246
|
"""
|
|
@@ -267,5 +267,5 @@ def makeSelection(options: list[Any], label: str, window_size: int=None, multi_s
|
|
|
267
267
|
return Menu(options, label, multi_select=multi_select).show()
|
|
268
268
|
|
|
269
269
|
if __name__ == "__main__":
|
|
270
|
-
print(f"Returns: '{makeSelection(['interactive', 'cli', 'menu'], 'make_selection')}'")
|
|
271
|
-
print(f"Returns: '{makeSelection(['interactive', 'cli', 'menu'], 'make_selection', multi_select=True)}'")
|
|
270
|
+
print(f"Returns: '{makeSelection(['interactive', 'cli', 'menu'], 'make_selection')}'", file=sys.stderr)
|
|
271
|
+
print(f"Returns: '{makeSelection(['interactive', 'cli', 'menu'], 'make_selection', multi_select=True)}'", file=sys.stderr)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: make_selection
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: Package for interactive command line menu
|
|
5
5
|
Author-email: Steven Frazee <stevefrazee123@gmail.com>
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -10,6 +10,7 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
10
10
|
Requires-Python: >=3.9
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
|
+
Dynamic: license-file
|
|
13
14
|
|
|
14
15
|
<p align="center">
|
|
15
16
|
<img src="https://github.com/steve3424/make_selection/blob/main/images/logo.png?raw=true" alt="Make selection logo">
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{make_selection-1.0.6 → make_selection-1.0.7}/src/make_selection.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|