command-manager-util 1.0.0__tar.gz → 1.1.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.
- {command_manager_util-1.0.0/src/command_manager_util.egg-info → command_manager_util-1.1.0}/PKG-INFO +1 -1
- {command_manager_util-1.0.0 → command_manager_util-1.1.0}/setup.py +1 -1
- {command_manager_util-1.0.0 → command_manager_util-1.1.0/src/command_manager_util.egg-info}/PKG-INFO +1 -1
- {command_manager_util-1.0.0 → command_manager_util-1.1.0}/src/main/__init__.py +46 -18
- {command_manager_util-1.0.0 → command_manager_util-1.1.0}/LICENSE +0 -0
- {command_manager_util-1.0.0 → command_manager_util-1.1.0}/README.md +0 -0
- {command_manager_util-1.0.0 → command_manager_util-1.1.0}/setup.cfg +0 -0
- {command_manager_util-1.0.0 → command_manager_util-1.1.0}/src/command_manager_util.egg-info/SOURCES.txt +0 -0
- {command_manager_util-1.0.0 → command_manager_util-1.1.0}/src/command_manager_util.egg-info/dependency_links.txt +0 -0
- {command_manager_util-1.0.0 → command_manager_util-1.1.0}/src/command_manager_util.egg-info/entry_points.txt +0 -0
- {command_manager_util-1.0.0 → command_manager_util-1.1.0}/src/command_manager_util.egg-info/top_level.txt +0 -0
|
@@ -60,21 +60,41 @@ def add_new_command(commands, category=None):
|
|
|
60
60
|
print(f"echo '✅ Added to {target_cat}'")
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
def
|
|
64
|
-
"""Handles
|
|
65
|
-
|
|
66
|
-
if
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
63
|
+
def delete_logic(commands, category=None):
|
|
64
|
+
"""Handles deletion of an entire category or a single command."""
|
|
65
|
+
# 1. DELETE WHOLE CATEGORY (if no specific category is passed)
|
|
66
|
+
if category is None:
|
|
67
|
+
categories = sorted(list(set(c[0] for c in commands)))
|
|
68
|
+
if not categories:
|
|
69
|
+
print("echo 'No categories to delete!'")
|
|
70
|
+
return
|
|
71
|
+
|
|
72
|
+
cat_to_wipe = run_fzf(categories, "SELECT CATEGORY TO WIPE ENTIRELY")
|
|
73
|
+
if cat_to_wipe:
|
|
74
|
+
conf = prompt_user(f"Delete ALL commands in [{cat_to_wipe}]? (y/n)")
|
|
75
|
+
if conf and conf.lower() == "y":
|
|
76
|
+
updated_commands = [c for c in commands if c[0] != cat_to_wipe]
|
|
77
|
+
save_commands(updated_commands)
|
|
78
|
+
print(f"echo '❌ Category [{cat_to_wipe}] deleted!'")
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
# 2. DELETE SINGLE COMMAND (if category is provided)
|
|
82
|
+
sub_cmds = [c for c in commands if c[0] == category]
|
|
83
|
+
cat_raw = [f"{c[1]} | {c[2]}" for c in sub_cmds]
|
|
84
|
+
|
|
85
|
+
to_delete_display = run_fzf(cat_raw, f"SELECT COMMAND TO DELETE FROM {category}")
|
|
86
|
+
|
|
87
|
+
if to_delete_display:
|
|
88
|
+
parts = [x.strip() for x in to_delete_display.split("|")]
|
|
89
|
+
if len(parts) >= 2:
|
|
90
|
+
d_name, d_cmd = parts[0], parts[1]
|
|
91
|
+
updated_commands = [
|
|
92
|
+
c
|
|
93
|
+
for c in commands
|
|
94
|
+
if not (c[0] == category and c[1] == d_name and c[2] == d_cmd)
|
|
95
|
+
]
|
|
96
|
+
save_commands(updated_commands)
|
|
97
|
+
print(f"echo '❌ Deleted [{d_name}] from {category}'")
|
|
78
98
|
|
|
79
99
|
|
|
80
100
|
def main():
|
|
@@ -95,13 +115,16 @@ def main():
|
|
|
95
115
|
return
|
|
96
116
|
|
|
97
117
|
if category == "[- Delete Category]":
|
|
98
|
-
|
|
118
|
+
delete_logic(commands)
|
|
99
119
|
return
|
|
100
120
|
|
|
101
121
|
# 2. COMMAND LEVEL
|
|
102
122
|
sub_cmds = [c for c in commands if c[0] == category]
|
|
103
123
|
cmd_options = [f"{c[1]}|{c[2]}" for c in sub_cmds]
|
|
104
|
-
cmd_options += [
|
|
124
|
+
cmd_options += [
|
|
125
|
+
f"[+ Add Command to {category}]",
|
|
126
|
+
f"[- Delete Command from {category}]",
|
|
127
|
+
]
|
|
105
128
|
|
|
106
129
|
selection = run_fzf(cmd_options, f"Commands in {category}")
|
|
107
130
|
|
|
@@ -112,6 +135,11 @@ def main():
|
|
|
112
135
|
add_new_command(commands, category)
|
|
113
136
|
return
|
|
114
137
|
|
|
138
|
+
# --- NEW LOGIC CALL ---
|
|
139
|
+
if selection == f"[- Delete Command from {category}]":
|
|
140
|
+
delete_logic(commands, category)
|
|
141
|
+
return
|
|
142
|
+
|
|
115
143
|
# 3. EXECUTE
|
|
116
|
-
print(selection.split("|", maxsplit
|
|
144
|
+
print(selection.split("|", maxsplit=2)[-1])
|
|
117
145
|
break
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|