command-manager-util 1.0.0__tar.gz → 1.1.1__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.1.1/MANIFEST.in +5 -0
- command_manager_util-1.1.1/PKG-INFO +161 -0
- command_manager_util-1.1.1/README.md +123 -0
- command_manager_util-1.1.1/pyproject.toml +3 -0
- command_manager_util-1.1.1/setup.py +56 -0
- command_manager_util-1.1.1/src/command_manager_util.egg-info/PKG-INFO +161 -0
- {command_manager_util-1.0.0 → command_manager_util-1.1.1}/src/command_manager_util.egg-info/SOURCES.txt +5 -1
- command_manager_util-1.1.1/src/command_manager_util.egg-info/entry_points.txt +2 -0
- command_manager_util-1.1.1/src/command_manager_util.egg-info/top_level.txt +1 -0
- command_manager_util-1.1.1/src/scm/__init__.py +6 -0
- command_manager_util-1.1.1/src/scm/__main__.py +4 -0
- command_manager_util-1.1.1/src/scm/cli.py +152 -0
- command_manager_util-1.0.0/PKG-INFO +0 -112
- command_manager_util-1.0.0/README.md +0 -89
- command_manager_util-1.0.0/setup.py +0 -47
- command_manager_util-1.0.0/src/command_manager_util.egg-info/PKG-INFO +0 -112
- command_manager_util-1.0.0/src/command_manager_util.egg-info/entry_points.txt +0 -2
- command_manager_util-1.0.0/src/command_manager_util.egg-info/top_level.txt +0 -1
- command_manager_util-1.0.0/src/main/__init__.py +0 -117
- {command_manager_util-1.0.0 → command_manager_util-1.1.1}/LICENSE +0 -0
- {command_manager_util-1.0.0 → command_manager_util-1.1.1}/setup.cfg +0 -0
- {command_manager_util-1.0.0 → command_manager_util-1.1.1}/src/command_manager_util.egg-info/dependency_links.txt +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: command-manager-util
|
|
3
|
+
Version: 1.1.1
|
|
4
|
+
Summary: Manage and execute shell commands from a categorized, fzf-powered menu.
|
|
5
|
+
Home-page: https://github.com/Sahaj001/Script-Manager
|
|
6
|
+
Author: Sahaj Pratap Singh
|
|
7
|
+
Author-email:
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Project-URL: Homepage, https://github.com/Sahaj001/Script-Manager
|
|
10
|
+
Project-URL: Source, https://github.com/Sahaj001/Script-Manager
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/Sahaj001/Script-Manager/issues
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Classifier: Environment :: Console
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.6
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Dynamic: author
|
|
29
|
+
Dynamic: classifier
|
|
30
|
+
Dynamic: description
|
|
31
|
+
Dynamic: description-content-type
|
|
32
|
+
Dynamic: home-page
|
|
33
|
+
Dynamic: license
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
Dynamic: project-url
|
|
36
|
+
Dynamic: requires-python
|
|
37
|
+
Dynamic: summary
|
|
38
|
+
|
|
39
|
+
# Script Command Manager (SCM)
|
|
40
|
+
|
|
41
|
+
[](https://github.com/Sahaj001/Script-Manager/actions/workflows/publish.yml)
|
|
42
|
+
[](https://github.com/Sahaj001/Script-Manager/actions/workflows/pylint.yml)
|
|
43
|
+
[](LICENSE)
|
|
44
|
+
|
|
45
|
+
A fast, terminal-first command manager for organizing and running shell commands with `fzf`.
|
|
46
|
+
|
|
47
|
+
## Overview
|
|
48
|
+
|
|
49
|
+
SCM helps you store frequently used shell commands by category and run them through an interactive fuzzy-search menu. It is designed for developers who want quick access to repeatable workflows without cluttering shell history manually.
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
- Fuzzy search with `fzf` for categories and commands
|
|
54
|
+
- Hierarchical organization by category
|
|
55
|
+
- In-app add/delete flows for commands and categories
|
|
56
|
+
- Lightweight local storage in `~/.work_commands`
|
|
57
|
+
- Simple shell integration for execution
|
|
58
|
+
|
|
59
|
+
## Requirements
|
|
60
|
+
|
|
61
|
+
- Python 3.6+
|
|
62
|
+
- [`fzf`](https://github.com/junegunn/fzf)
|
|
63
|
+
|
|
64
|
+
Install `fzf` on macOS:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
brew install fzf
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
### From source (local development)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone https://github.com/Sahaj001/Script-Manager.git
|
|
76
|
+
cd Script-Manager
|
|
77
|
+
pip install -e .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Shell Setup
|
|
81
|
+
|
|
82
|
+
Add the following function/alias to your `~/.zshrc` or `~/.bashrc`:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
scm_run() {
|
|
86
|
+
local result
|
|
87
|
+
result="$(scm)"
|
|
88
|
+
if [[ -n "$result" ]]; then
|
|
89
|
+
eval "$result"
|
|
90
|
+
fi
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
alias s='scm_run'
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Reload your shell config:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
source ~/.zshrc # or source ~/.bashrc
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Usage
|
|
103
|
+
|
|
104
|
+
Run:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
s
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Navigation:
|
|
111
|
+
|
|
112
|
+
- Use arrow keys or type to filter
|
|
113
|
+
- Press `Enter` to execute a selected command
|
|
114
|
+
- Use `[+ Add New Category]` to create categories
|
|
115
|
+
- Use `[+ Add Command to ...]` to add commands
|
|
116
|
+
- Use delete options to remove commands/categories
|
|
117
|
+
|
|
118
|
+
## Data Storage
|
|
119
|
+
|
|
120
|
+
Commands are stored locally at:
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
~/.work_commands
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Format per line:
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
Category|Display Name|Shell Command
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
Install in editable mode:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pip install -e .
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Run lint:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pylint $(git ls-files '*.py') --disable=C0114,C0115,C0116,R1710,R0912,R1705
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Contributing
|
|
147
|
+
|
|
148
|
+
Contributions are welcome.
|
|
149
|
+
|
|
150
|
+
1. Fork the repository
|
|
151
|
+
2. Create a feature branch
|
|
152
|
+
3. Commit your changes
|
|
153
|
+
4. Open a pull request
|
|
154
|
+
|
|
155
|
+
For major changes, open an issue first to discuss what you would like to change.
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
Licensed under the [Apache License 2.0](LICENSE).
|
|
160
|
+
|
|
161
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Script Command Manager (SCM)
|
|
2
|
+
|
|
3
|
+
[](https://github.com/Sahaj001/Script-Manager/actions/workflows/publish.yml)
|
|
4
|
+
[](https://github.com/Sahaj001/Script-Manager/actions/workflows/pylint.yml)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
A fast, terminal-first command manager for organizing and running shell commands with `fzf`.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
SCM helps you store frequently used shell commands by category and run them through an interactive fuzzy-search menu. It is designed for developers who want quick access to repeatable workflows without cluttering shell history manually.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- Fuzzy search with `fzf` for categories and commands
|
|
16
|
+
- Hierarchical organization by category
|
|
17
|
+
- In-app add/delete flows for commands and categories
|
|
18
|
+
- Lightweight local storage in `~/.work_commands`
|
|
19
|
+
- Simple shell integration for execution
|
|
20
|
+
|
|
21
|
+
## Requirements
|
|
22
|
+
|
|
23
|
+
- Python 3.6+
|
|
24
|
+
- [`fzf`](https://github.com/junegunn/fzf)
|
|
25
|
+
|
|
26
|
+
Install `fzf` on macOS:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
brew install fzf
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
### From source (local development)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://github.com/Sahaj001/Script-Manager.git
|
|
38
|
+
cd Script-Manager
|
|
39
|
+
pip install -e .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Shell Setup
|
|
43
|
+
|
|
44
|
+
Add the following function/alias to your `~/.zshrc` or `~/.bashrc`:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
scm_run() {
|
|
48
|
+
local result
|
|
49
|
+
result="$(scm)"
|
|
50
|
+
if [[ -n "$result" ]]; then
|
|
51
|
+
eval "$result"
|
|
52
|
+
fi
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
alias s='scm_run'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Reload your shell config:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
source ~/.zshrc # or source ~/.bashrc
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
Run:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
s
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Navigation:
|
|
73
|
+
|
|
74
|
+
- Use arrow keys or type to filter
|
|
75
|
+
- Press `Enter` to execute a selected command
|
|
76
|
+
- Use `[+ Add New Category]` to create categories
|
|
77
|
+
- Use `[+ Add Command to ...]` to add commands
|
|
78
|
+
- Use delete options to remove commands/categories
|
|
79
|
+
|
|
80
|
+
## Data Storage
|
|
81
|
+
|
|
82
|
+
Commands are stored locally at:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
~/.work_commands
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Format per line:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
Category|Display Name|Shell Command
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Development
|
|
95
|
+
|
|
96
|
+
Install in editable mode:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pip install -e .
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Run lint:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pylint $(git ls-files '*.py') --disable=C0114,C0115,C0116,R1710,R0912,R1705
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Contributing
|
|
109
|
+
|
|
110
|
+
Contributions are welcome.
|
|
111
|
+
|
|
112
|
+
1. Fork the repository
|
|
113
|
+
2. Create a feature branch
|
|
114
|
+
3. Commit your changes
|
|
115
|
+
4. Open a pull request
|
|
116
|
+
|
|
117
|
+
For major changes, open an issue first to discuss what you would like to change.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
Licensed under the [Apache License 2.0](LICENSE).
|
|
122
|
+
|
|
123
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Setup configuration for the Script Command Manager (SCM) package."""
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from setuptools import find_packages, setup
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def read_readme() -> str:
|
|
8
|
+
readme_path = Path(__file__).parent / "README.md"
|
|
9
|
+
if readme_path.exists():
|
|
10
|
+
return readme_path.read_text(encoding="utf-8")
|
|
11
|
+
return "Command manager using fzf"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
setup(
|
|
15
|
+
name="command-manager-util",
|
|
16
|
+
version="1.1.1",
|
|
17
|
+
description="Manage and execute shell commands from a categorized, fzf-powered menu.",
|
|
18
|
+
long_description=read_readme(),
|
|
19
|
+
long_description_content_type="text/markdown",
|
|
20
|
+
author="Sahaj Pratap Singh",
|
|
21
|
+
author_email="",
|
|
22
|
+
url="https://github.com/Sahaj001/Script-Manager",
|
|
23
|
+
project_urls={
|
|
24
|
+
"Homepage": "https://github.com/Sahaj001/Script-Manager",
|
|
25
|
+
"Source": "https://github.com/Sahaj001/Script-Manager",
|
|
26
|
+
"Bug Tracker": "https://github.com/Sahaj001/Script-Manager/issues",
|
|
27
|
+
},
|
|
28
|
+
classifiers=[
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
31
|
+
"Programming Language :: Python :: 3.6",
|
|
32
|
+
"Programming Language :: Python :: 3.7",
|
|
33
|
+
"Programming Language :: Python :: 3.8",
|
|
34
|
+
"Programming Language :: Python :: 3.9",
|
|
35
|
+
"Programming Language :: Python :: 3.10",
|
|
36
|
+
"Programming Language :: Python :: 3.11",
|
|
37
|
+
"Programming Language :: Python :: 3.12",
|
|
38
|
+
"License :: OSI Approved :: Apache Software License",
|
|
39
|
+
"Operating System :: OS Independent",
|
|
40
|
+
"Environment :: Console",
|
|
41
|
+
"Topic :: Utilities",
|
|
42
|
+
],
|
|
43
|
+
package_dir={"": "src"},
|
|
44
|
+
packages=find_packages(where="src"),
|
|
45
|
+
install_requires=[],
|
|
46
|
+
python_requires=">=3.6",
|
|
47
|
+
include_package_data=True,
|
|
48
|
+
entry_points={
|
|
49
|
+
"console_scripts": [
|
|
50
|
+
"scm=scm.cli:main",
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
license="Apache-2.0",
|
|
55
|
+
)
|
|
56
|
+
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: command-manager-util
|
|
3
|
+
Version: 1.1.1
|
|
4
|
+
Summary: Manage and execute shell commands from a categorized, fzf-powered menu.
|
|
5
|
+
Home-page: https://github.com/Sahaj001/Script-Manager
|
|
6
|
+
Author: Sahaj Pratap Singh
|
|
7
|
+
Author-email:
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Project-URL: Homepage, https://github.com/Sahaj001/Script-Manager
|
|
10
|
+
Project-URL: Source, https://github.com/Sahaj001/Script-Manager
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/Sahaj001/Script-Manager/issues
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Classifier: Environment :: Console
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.6
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Dynamic: author
|
|
29
|
+
Dynamic: classifier
|
|
30
|
+
Dynamic: description
|
|
31
|
+
Dynamic: description-content-type
|
|
32
|
+
Dynamic: home-page
|
|
33
|
+
Dynamic: license
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
Dynamic: project-url
|
|
36
|
+
Dynamic: requires-python
|
|
37
|
+
Dynamic: summary
|
|
38
|
+
|
|
39
|
+
# Script Command Manager (SCM)
|
|
40
|
+
|
|
41
|
+
[](https://github.com/Sahaj001/Script-Manager/actions/workflows/publish.yml)
|
|
42
|
+
[](https://github.com/Sahaj001/Script-Manager/actions/workflows/pylint.yml)
|
|
43
|
+
[](LICENSE)
|
|
44
|
+
|
|
45
|
+
A fast, terminal-first command manager for organizing and running shell commands with `fzf`.
|
|
46
|
+
|
|
47
|
+
## Overview
|
|
48
|
+
|
|
49
|
+
SCM helps you store frequently used shell commands by category and run them through an interactive fuzzy-search menu. It is designed for developers who want quick access to repeatable workflows without cluttering shell history manually.
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
- Fuzzy search with `fzf` for categories and commands
|
|
54
|
+
- Hierarchical organization by category
|
|
55
|
+
- In-app add/delete flows for commands and categories
|
|
56
|
+
- Lightweight local storage in `~/.work_commands`
|
|
57
|
+
- Simple shell integration for execution
|
|
58
|
+
|
|
59
|
+
## Requirements
|
|
60
|
+
|
|
61
|
+
- Python 3.6+
|
|
62
|
+
- [`fzf`](https://github.com/junegunn/fzf)
|
|
63
|
+
|
|
64
|
+
Install `fzf` on macOS:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
brew install fzf
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
### From source (local development)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone https://github.com/Sahaj001/Script-Manager.git
|
|
76
|
+
cd Script-Manager
|
|
77
|
+
pip install -e .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Shell Setup
|
|
81
|
+
|
|
82
|
+
Add the following function/alias to your `~/.zshrc` or `~/.bashrc`:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
scm_run() {
|
|
86
|
+
local result
|
|
87
|
+
result="$(scm)"
|
|
88
|
+
if [[ -n "$result" ]]; then
|
|
89
|
+
eval "$result"
|
|
90
|
+
fi
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
alias s='scm_run'
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Reload your shell config:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
source ~/.zshrc # or source ~/.bashrc
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Usage
|
|
103
|
+
|
|
104
|
+
Run:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
s
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Navigation:
|
|
111
|
+
|
|
112
|
+
- Use arrow keys or type to filter
|
|
113
|
+
- Press `Enter` to execute a selected command
|
|
114
|
+
- Use `[+ Add New Category]` to create categories
|
|
115
|
+
- Use `[+ Add Command to ...]` to add commands
|
|
116
|
+
- Use delete options to remove commands/categories
|
|
117
|
+
|
|
118
|
+
## Data Storage
|
|
119
|
+
|
|
120
|
+
Commands are stored locally at:
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
~/.work_commands
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Format per line:
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
Category|Display Name|Shell Command
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
Install in editable mode:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pip install -e .
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Run lint:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pylint $(git ls-files '*.py') --disable=C0114,C0115,C0116,R1710,R0912,R1705
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Contributing
|
|
147
|
+
|
|
148
|
+
Contributions are welcome.
|
|
149
|
+
|
|
150
|
+
1. Fork the repository
|
|
151
|
+
2. Create a feature branch
|
|
152
|
+
3. Commit your changes
|
|
153
|
+
4. Open a pull request
|
|
154
|
+
|
|
155
|
+
For major changes, open an issue first to discuss what you would like to change.
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
Licensed under the [Apache License 2.0](LICENSE).
|
|
160
|
+
|
|
161
|
+
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
2
3
|
README.md
|
|
4
|
+
pyproject.toml
|
|
3
5
|
setup.py
|
|
4
6
|
src/command_manager_util.egg-info/PKG-INFO
|
|
5
7
|
src/command_manager_util.egg-info/SOURCES.txt
|
|
6
8
|
src/command_manager_util.egg-info/dependency_links.txt
|
|
7
9
|
src/command_manager_util.egg-info/entry_points.txt
|
|
8
10
|
src/command_manager_util.egg-info/top_level.txt
|
|
9
|
-
src/
|
|
11
|
+
src/scm/__init__.py
|
|
12
|
+
src/scm/__main__.py
|
|
13
|
+
src/scm/cli.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
scm
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"""CLI implementation for Script Command Manager (SCM)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
from typing import List
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
CONFIG_FILE = os.path.expanduser("~/.work_commands")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def load_commands() -> List[List[str]]:
|
|
14
|
+
"""Load commands from the config file."""
|
|
15
|
+
if not os.path.exists(CONFIG_FILE):
|
|
16
|
+
return []
|
|
17
|
+
commands: List[List[str]] = []
|
|
18
|
+
with open(CONFIG_FILE, "r", encoding="utf-8") as f:
|
|
19
|
+
for line in f:
|
|
20
|
+
line = line.strip()
|
|
21
|
+
if not line or "|" not in line:
|
|
22
|
+
continue
|
|
23
|
+
commands.append(line.split("|", 2))
|
|
24
|
+
return commands
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def save_commands(commands: List[List[str]]) -> None:
|
|
28
|
+
"""Save commands to the config file."""
|
|
29
|
+
with open(CONFIG_FILE, "w", encoding="utf-8") as f:
|
|
30
|
+
for cmd in commands:
|
|
31
|
+
f.write("|".join(cmd) + "\n")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def run_fzf(options: List[str], header: str) -> str | None:
|
|
35
|
+
"""Run fuzzy finder and return the selected option."""
|
|
36
|
+
input_str = "\n".join(options)
|
|
37
|
+
try:
|
|
38
|
+
with subprocess.Popen(
|
|
39
|
+
["fzf", "--height", "40%", "--reverse", "--header", header],
|
|
40
|
+
stdin=subprocess.PIPE,
|
|
41
|
+
stdout=subprocess.PIPE,
|
|
42
|
+
text=True,
|
|
43
|
+
) as process:
|
|
44
|
+
stdout, _ = process.communicate(input=input_str)
|
|
45
|
+
return stdout.strip() if stdout else None
|
|
46
|
+
except FileNotFoundError:
|
|
47
|
+
print("Error: 'fzf' binary not found. Please install it via brew/apt.")
|
|
48
|
+
return None
|
|
49
|
+
except subprocess.SubprocessError:
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def prompt_user(msg: str) -> str:
|
|
54
|
+
"""Prompt the user for input."""
|
|
55
|
+
sys.stderr.write(f"{msg}: ")
|
|
56
|
+
sys.stderr.flush()
|
|
57
|
+
return sys.stdin.readline().strip()
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def add_new_command(commands: List[List[str]], category: str | None = None) -> None:
|
|
61
|
+
"""Handle adding a new command via interactive prompts."""
|
|
62
|
+
target_cat = category or prompt_user("Enter Category Name")
|
|
63
|
+
name = prompt_user("Enter Display Name")
|
|
64
|
+
cmd = prompt_user("Enter Bash Command")
|
|
65
|
+
|
|
66
|
+
if target_cat and name and cmd:
|
|
67
|
+
commands.append([target_cat, name, cmd])
|
|
68
|
+
save_commands(commands)
|
|
69
|
+
print(f"echo '✅ Added to {target_cat}'")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def delete_logic(commands: List[List[str]], category: str | None = None) -> None:
|
|
73
|
+
"""Handle deletion of a whole category or a single command."""
|
|
74
|
+
if category is None:
|
|
75
|
+
categories = sorted({c[0] for c in commands})
|
|
76
|
+
if not categories:
|
|
77
|
+
print("echo 'No categories to delete!'")
|
|
78
|
+
return
|
|
79
|
+
|
|
80
|
+
cat_to_wipe = run_fzf(categories, "SELECT CATEGORY TO WIPE ENTIRELY")
|
|
81
|
+
if cat_to_wipe:
|
|
82
|
+
conf = prompt_user(f"Delete ALL commands in [{cat_to_wipe}]? (y/n)")
|
|
83
|
+
if conf and conf.lower() == "y":
|
|
84
|
+
updated_commands = [c for c in commands if c[0] != cat_to_wipe]
|
|
85
|
+
save_commands(updated_commands)
|
|
86
|
+
print(f"echo '❌ Category [{cat_to_wipe}] deleted!'")
|
|
87
|
+
return
|
|
88
|
+
|
|
89
|
+
sub_cmds = [c for c in commands if c[0] == category]
|
|
90
|
+
cat_raw = [f"{c[1]} | {c[2]}" for c in sub_cmds]
|
|
91
|
+
|
|
92
|
+
to_delete_display = run_fzf(cat_raw, f"SELECT COMMAND TO DELETE FROM {category}")
|
|
93
|
+
|
|
94
|
+
if to_delete_display:
|
|
95
|
+
parts = [x.strip() for x in to_delete_display.split("|", 1)]
|
|
96
|
+
if len(parts) == 2:
|
|
97
|
+
d_name, d_cmd = parts[0], parts[1]
|
|
98
|
+
updated_commands = [
|
|
99
|
+
c
|
|
100
|
+
for c in commands
|
|
101
|
+
if not (c[0] == category and c[1] == d_name and c[2] == d_cmd)
|
|
102
|
+
]
|
|
103
|
+
save_commands(updated_commands)
|
|
104
|
+
print(f"echo '❌ Deleted [{d_name}] from {category}'")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def main() -> None:
|
|
108
|
+
"""Main entry point for the SCM CLI."""
|
|
109
|
+
while True:
|
|
110
|
+
commands = load_commands()
|
|
111
|
+
categories = sorted({c[0] for c in commands})
|
|
112
|
+
|
|
113
|
+
cat_options = categories + ["[+ Add New Category]", "[- Delete Category]"]
|
|
114
|
+
category = run_fzf(cat_options, "Select Category (Esc to Exit)")
|
|
115
|
+
|
|
116
|
+
if not category:
|
|
117
|
+
sys.exit(0)
|
|
118
|
+
|
|
119
|
+
if category == "[+ Add New Category]":
|
|
120
|
+
add_new_command(commands)
|
|
121
|
+
return
|
|
122
|
+
|
|
123
|
+
if category == "[- Delete Category]":
|
|
124
|
+
delete_logic(commands)
|
|
125
|
+
return
|
|
126
|
+
|
|
127
|
+
sub_cmds = [c for c in commands if c[0] == category]
|
|
128
|
+
cmd_options = [f"{c[1]}|{c[2]}" for c in sub_cmds]
|
|
129
|
+
cmd_options += [
|
|
130
|
+
f"[+ Add Command to {category}]",
|
|
131
|
+
f"[- Delete Command from {category}]",
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
selection = run_fzf(cmd_options, f"Commands in {category}")
|
|
135
|
+
|
|
136
|
+
if not selection:
|
|
137
|
+
continue
|
|
138
|
+
|
|
139
|
+
if selection == f"[+ Add Command to {category}]":
|
|
140
|
+
add_new_command(commands, category)
|
|
141
|
+
return
|
|
142
|
+
|
|
143
|
+
if selection == f"[- Delete Command from {category}]":
|
|
144
|
+
delete_logic(commands, category)
|
|
145
|
+
return
|
|
146
|
+
|
|
147
|
+
print(selection.split("|", 1)[-1])
|
|
148
|
+
break
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
if __name__ == "__main__":
|
|
152
|
+
main()
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: command-manager-util
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: Manages useful commands in one place using fzf
|
|
5
|
-
Home-page: https://github.com/Sahaj001/Script-Manager
|
|
6
|
-
Author: Sahaj Pratap Singh
|
|
7
|
-
License: Apache 2.0
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.6
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
License-File: LICENSE
|
|
14
|
-
Dynamic: author
|
|
15
|
-
Dynamic: classifier
|
|
16
|
-
Dynamic: description
|
|
17
|
-
Dynamic: description-content-type
|
|
18
|
-
Dynamic: home-page
|
|
19
|
-
Dynamic: license
|
|
20
|
-
Dynamic: license-file
|
|
21
|
-
Dynamic: requires-python
|
|
22
|
-
Dynamic: summary
|
|
23
|
-
|
|
24
|
-
[](https://github.com/Sahaj001/Script-Manager/actions/workflows/publish.yml)
|
|
25
|
-
|
|
26
|
-
# Script-Command-Manager (SCM)
|
|
27
|
-
# 🚀 SCM Tool Guide
|
|
28
|
-
|
|
29
|
-
A streamlined command manager for your terminal workflows.
|
|
30
|
-
|
|
31
|
-
## Overview
|
|
32
|
-
|
|
33
|
-
**SCM** is a high-performance CLI tool designed to catalog, manage, and execute complex shell commands through an intuitive fuzzy-finding interface. Built with Python and powered by `fzf`, it eliminates the need to remember arcane syntax or sift through endless history files.
|
|
34
|
-
|
|
35
|
-
## Features
|
|
36
|
-
* **Fuzzy Search Navigation**: Instant filtering of categories and commands using `fzf`.
|
|
37
|
-
* **Hierarchical Management**: Organize commands into custom categories (e.g., Work, Dev, Personal).
|
|
38
|
-
* **In-App Administration**: Add or delete commands and entire categories directly from the interface.
|
|
39
|
-
* **Shell History Integration**: Commands executed via SCM can be injected into your shell history for easy access later.
|
|
40
|
-
* **Mac-Optimized Core**: Robust file I/O designed to handle macOS-specific shell environments and `sed/grep` variations.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Installation
|
|
45
|
-
|
|
46
|
-
### Prerequisites
|
|
47
|
-
1. **Python**: 3.6 or higher.
|
|
48
|
-
2. **fzf**: Must be installed on your system.
|
|
49
|
-
```bash
|
|
50
|
-
brew install fzf
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Local Setup
|
|
54
|
-
1. Clone the repository:
|
|
55
|
-
```bash
|
|
56
|
-
git clone [https://github.com/Sahaj001/Script-Manager.git](https://github.com/Sahaj001/Script-Manager.git)
|
|
57
|
-
cd Script-Manager
|
|
58
|
-
```
|
|
59
|
-
2. Install in editable mode:
|
|
60
|
-
```bash
|
|
61
|
-
pip install -e .
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## Configuration
|
|
67
|
-
|
|
68
|
-
To enable command execution and history injection, add the following wrapper to your `~/.zshrc` or `~/.bashrc`:
|
|
69
|
-
```bash
|
|
70
|
-
### SCM START ###
|
|
71
|
-
rscm() {
|
|
72
|
-
local result=$(scm)
|
|
73
|
-
if [[ -n "$result" ]]; then
|
|
74
|
-
eval " $result"
|
|
75
|
-
fi
|
|
76
|
-
}
|
|
77
|
-
alias s='rscm'
|
|
78
|
-
### SCM END ###
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
### 🚀 Usage
|
|
84
|
-
> **Note**
|
|
85
|
-
> Simply type `s` or `run_scm` in your terminal to launch the interactive menu.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## 🛠 Features & Navigation
|
|
91
|
-
|
|
92
|
-
* **Select a Category:** Use the **arrow keys** to navigate or **start typing** to filter through your existing groups.
|
|
93
|
-
* **Execute:** Choose a specific command and hit `Enter` to run it directly in your current shell.
|
|
94
|
-
* **Management:**
|
|
95
|
-
* `[+ Add New Category]` — Create a new group for your commands.
|
|
96
|
-
* `[+ Add Command to...]` — Expand your library within a specific category.
|
|
97
|
-
* `[-] Delete` — Prune old or unused commands and groups.
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
## 🤝 Contributing
|
|
103
|
-
|
|
104
|
-
Contributions make the terminal better for everyone!
|
|
105
|
-
|
|
106
|
-
1. **Fork** the repository.
|
|
107
|
-
2. **Submit** a pull request with your improvements.
|
|
108
|
-
3. *For major changes:* Please **open an issue** first to discuss your ideas so we can stay aligned on the project goals.
|
|
109
|
-
|
|
110
|
-
License
|
|
111
|
-
Apache License 2.0
|
|
112
|
-
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
[](https://github.com/Sahaj001/Script-Manager/actions/workflows/publish.yml)
|
|
2
|
-
|
|
3
|
-
# Script-Command-Manager (SCM)
|
|
4
|
-
# 🚀 SCM Tool Guide
|
|
5
|
-
|
|
6
|
-
A streamlined command manager for your terminal workflows.
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
**SCM** is a high-performance CLI tool designed to catalog, manage, and execute complex shell commands through an intuitive fuzzy-finding interface. Built with Python and powered by `fzf`, it eliminates the need to remember arcane syntax or sift through endless history files.
|
|
11
|
-
|
|
12
|
-
## Features
|
|
13
|
-
* **Fuzzy Search Navigation**: Instant filtering of categories and commands using `fzf`.
|
|
14
|
-
* **Hierarchical Management**: Organize commands into custom categories (e.g., Work, Dev, Personal).
|
|
15
|
-
* **In-App Administration**: Add or delete commands and entire categories directly from the interface.
|
|
16
|
-
* **Shell History Integration**: Commands executed via SCM can be injected into your shell history for easy access later.
|
|
17
|
-
* **Mac-Optimized Core**: Robust file I/O designed to handle macOS-specific shell environments and `sed/grep` variations.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
22
|
-
|
|
23
|
-
### Prerequisites
|
|
24
|
-
1. **Python**: 3.6 or higher.
|
|
25
|
-
2. **fzf**: Must be installed on your system.
|
|
26
|
-
```bash
|
|
27
|
-
brew install fzf
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Local Setup
|
|
31
|
-
1. Clone the repository:
|
|
32
|
-
```bash
|
|
33
|
-
git clone [https://github.com/Sahaj001/Script-Manager.git](https://github.com/Sahaj001/Script-Manager.git)
|
|
34
|
-
cd Script-Manager
|
|
35
|
-
```
|
|
36
|
-
2. Install in editable mode:
|
|
37
|
-
```bash
|
|
38
|
-
pip install -e .
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Configuration
|
|
44
|
-
|
|
45
|
-
To enable command execution and history injection, add the following wrapper to your `~/.zshrc` or `~/.bashrc`:
|
|
46
|
-
```bash
|
|
47
|
-
### SCM START ###
|
|
48
|
-
rscm() {
|
|
49
|
-
local result=$(scm)
|
|
50
|
-
if [[ -n "$result" ]]; then
|
|
51
|
-
eval " $result"
|
|
52
|
-
fi
|
|
53
|
-
}
|
|
54
|
-
alias s='rscm'
|
|
55
|
-
### SCM END ###
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
### 🚀 Usage
|
|
61
|
-
> **Note**
|
|
62
|
-
> Simply type `s` or `run_scm` in your terminal to launch the interactive menu.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## 🛠 Features & Navigation
|
|
68
|
-
|
|
69
|
-
* **Select a Category:** Use the **arrow keys** to navigate or **start typing** to filter through your existing groups.
|
|
70
|
-
* **Execute:** Choose a specific command and hit `Enter` to run it directly in your current shell.
|
|
71
|
-
* **Management:**
|
|
72
|
-
* `[+ Add New Category]` — Create a new group for your commands.
|
|
73
|
-
* `[+ Add Command to...]` — Expand your library within a specific category.
|
|
74
|
-
* `[-] Delete` — Prune old or unused commands and groups.
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
## 🤝 Contributing
|
|
80
|
-
|
|
81
|
-
Contributions make the terminal better for everyone!
|
|
82
|
-
|
|
83
|
-
1. **Fork** the repository.
|
|
84
|
-
2. **Submit** a pull request with your improvements.
|
|
85
|
-
3. *For major changes:* Please **open an issue** first to discuss your ideas so we can stay aligned on the project goals.
|
|
86
|
-
|
|
87
|
-
License
|
|
88
|
-
Apache License 2.0
|
|
89
|
-
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Setup configuration for the S-Command-Manager (SCM) package.
|
|
3
|
-
|
|
4
|
-
This script uses setuptools to manage the installation, packaging, and
|
|
5
|
-
distribution of SCM. It defines the 'scm' entry point, allowing the
|
|
6
|
-
logic to be executed as a standalone CLI tool.
|
|
7
|
-
|
|
8
|
-
Key Features:
|
|
9
|
-
- Defines a console script entry point 'scm' mapping to main:start.
|
|
10
|
-
- Configured for local 'editable' installation for development.
|
|
11
|
-
|
|
12
|
-
Author: Sahaj Pratap Singh
|
|
13
|
-
License: Apache License 2.0
|
|
14
|
-
"""
|
|
15
|
-
from setuptools import setup
|
|
16
|
-
|
|
17
|
-
def read_file():
|
|
18
|
-
"""Read the README file."""
|
|
19
|
-
try:
|
|
20
|
-
with open("README.md", "r", encoding='utf-8') as f:
|
|
21
|
-
return f.read()
|
|
22
|
-
except FileNotFoundError:
|
|
23
|
-
return "Command manager using fzf"
|
|
24
|
-
|
|
25
|
-
setup(
|
|
26
|
-
name="command-manager-util",
|
|
27
|
-
version="1.0.0",
|
|
28
|
-
description="Manages useful commands in one place using fzf",
|
|
29
|
-
long_description=read_file(),
|
|
30
|
-
long_description_content_type="text/markdown",
|
|
31
|
-
author="Sahaj Pratap Singh",
|
|
32
|
-
url="https://github.com/Sahaj001/Script-Manager",
|
|
33
|
-
classifiers=[
|
|
34
|
-
"Programming Language :: Python :: 3",
|
|
35
|
-
"License :: OSI Approved :: Apache Software License",
|
|
36
|
-
"Operating System :: OS Independent",
|
|
37
|
-
],
|
|
38
|
-
install_requires=[],
|
|
39
|
-
python_requires='>=3.6',
|
|
40
|
-
include_package_data=True,
|
|
41
|
-
entry_points={
|
|
42
|
-
'console_scripts': [
|
|
43
|
-
'scm=main:main',
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
license="Apache 2.0",
|
|
47
|
-
)
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: command-manager-util
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: Manages useful commands in one place using fzf
|
|
5
|
-
Home-page: https://github.com/Sahaj001/Script-Manager
|
|
6
|
-
Author: Sahaj Pratap Singh
|
|
7
|
-
License: Apache 2.0
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.6
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
License-File: LICENSE
|
|
14
|
-
Dynamic: author
|
|
15
|
-
Dynamic: classifier
|
|
16
|
-
Dynamic: description
|
|
17
|
-
Dynamic: description-content-type
|
|
18
|
-
Dynamic: home-page
|
|
19
|
-
Dynamic: license
|
|
20
|
-
Dynamic: license-file
|
|
21
|
-
Dynamic: requires-python
|
|
22
|
-
Dynamic: summary
|
|
23
|
-
|
|
24
|
-
[](https://github.com/Sahaj001/Script-Manager/actions/workflows/publish.yml)
|
|
25
|
-
|
|
26
|
-
# Script-Command-Manager (SCM)
|
|
27
|
-
# 🚀 SCM Tool Guide
|
|
28
|
-
|
|
29
|
-
A streamlined command manager for your terminal workflows.
|
|
30
|
-
|
|
31
|
-
## Overview
|
|
32
|
-
|
|
33
|
-
**SCM** is a high-performance CLI tool designed to catalog, manage, and execute complex shell commands through an intuitive fuzzy-finding interface. Built with Python and powered by `fzf`, it eliminates the need to remember arcane syntax or sift through endless history files.
|
|
34
|
-
|
|
35
|
-
## Features
|
|
36
|
-
* **Fuzzy Search Navigation**: Instant filtering of categories and commands using `fzf`.
|
|
37
|
-
* **Hierarchical Management**: Organize commands into custom categories (e.g., Work, Dev, Personal).
|
|
38
|
-
* **In-App Administration**: Add or delete commands and entire categories directly from the interface.
|
|
39
|
-
* **Shell History Integration**: Commands executed via SCM can be injected into your shell history for easy access later.
|
|
40
|
-
* **Mac-Optimized Core**: Robust file I/O designed to handle macOS-specific shell environments and `sed/grep` variations.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Installation
|
|
45
|
-
|
|
46
|
-
### Prerequisites
|
|
47
|
-
1. **Python**: 3.6 or higher.
|
|
48
|
-
2. **fzf**: Must be installed on your system.
|
|
49
|
-
```bash
|
|
50
|
-
brew install fzf
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Local Setup
|
|
54
|
-
1. Clone the repository:
|
|
55
|
-
```bash
|
|
56
|
-
git clone [https://github.com/Sahaj001/Script-Manager.git](https://github.com/Sahaj001/Script-Manager.git)
|
|
57
|
-
cd Script-Manager
|
|
58
|
-
```
|
|
59
|
-
2. Install in editable mode:
|
|
60
|
-
```bash
|
|
61
|
-
pip install -e .
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## Configuration
|
|
67
|
-
|
|
68
|
-
To enable command execution and history injection, add the following wrapper to your `~/.zshrc` or `~/.bashrc`:
|
|
69
|
-
```bash
|
|
70
|
-
### SCM START ###
|
|
71
|
-
rscm() {
|
|
72
|
-
local result=$(scm)
|
|
73
|
-
if [[ -n "$result" ]]; then
|
|
74
|
-
eval " $result"
|
|
75
|
-
fi
|
|
76
|
-
}
|
|
77
|
-
alias s='rscm'
|
|
78
|
-
### SCM END ###
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
### 🚀 Usage
|
|
84
|
-
> **Note**
|
|
85
|
-
> Simply type `s` or `run_scm` in your terminal to launch the interactive menu.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## 🛠 Features & Navigation
|
|
91
|
-
|
|
92
|
-
* **Select a Category:** Use the **arrow keys** to navigate or **start typing** to filter through your existing groups.
|
|
93
|
-
* **Execute:** Choose a specific command and hit `Enter` to run it directly in your current shell.
|
|
94
|
-
* **Management:**
|
|
95
|
-
* `[+ Add New Category]` — Create a new group for your commands.
|
|
96
|
-
* `[+ Add Command to...]` — Expand your library within a specific category.
|
|
97
|
-
* `[-] Delete` — Prune old or unused commands and groups.
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
## 🤝 Contributing
|
|
103
|
-
|
|
104
|
-
Contributions make the terminal better for everyone!
|
|
105
|
-
|
|
106
|
-
1. **Fork** the repository.
|
|
107
|
-
2. **Submit** a pull request with your improvements.
|
|
108
|
-
3. *For major changes:* Please **open an issue** first to discuss your ideas so we can stay aligned on the project goals.
|
|
109
|
-
|
|
110
|
-
License
|
|
111
|
-
Apache License 2.0
|
|
112
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
main
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
# main.py
|
|
2
|
-
import subprocess
|
|
3
|
-
import os
|
|
4
|
-
import sys
|
|
5
|
-
|
|
6
|
-
CONFIG_FILE = os.path.expanduser("~/.work_commands")
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def load_commands():
|
|
10
|
-
"""Loods commadns"""
|
|
11
|
-
if not os.path.exists(CONFIG_FILE):
|
|
12
|
-
return []
|
|
13
|
-
with open(CONFIG_FILE, "r", encoding="utf-8") as f:
|
|
14
|
-
# Filter out empty lines and ensure 3 parts per line
|
|
15
|
-
return [line.strip().split("|") for line in f if line.strip() and "|" in line]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def save_commands(commands):
|
|
19
|
-
"""Save commands"""
|
|
20
|
-
with open(CONFIG_FILE, "w", encoding="utf-8") as f:
|
|
21
|
-
for cmd in commands:
|
|
22
|
-
f.write("|".join(cmd) + "\n")
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def run_fzf(options, header):
|
|
26
|
-
"""Run fuzzy finder"""
|
|
27
|
-
input_str = "\n".join(options)
|
|
28
|
-
try:
|
|
29
|
-
with subprocess.Popen(
|
|
30
|
-
["fzf", "--height", "40%", "--reverse", "--header", header],
|
|
31
|
-
stdin=subprocess.PIPE,
|
|
32
|
-
stdout=subprocess.PIPE,
|
|
33
|
-
text=True,
|
|
34
|
-
) as process:
|
|
35
|
-
stdout, _ = process.communicate(input=input_str)
|
|
36
|
-
return stdout.strip() if stdout else None
|
|
37
|
-
except FileNotFoundError:
|
|
38
|
-
print("Error: 'fzf' binary not found. Please install it via brew/apt.")
|
|
39
|
-
return None
|
|
40
|
-
except subprocess.SubprocessError:
|
|
41
|
-
return None
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def prompt_user(msg):
|
|
45
|
-
"""Prompt to user"""
|
|
46
|
-
sys.stderr.write(f"{msg}: ")
|
|
47
|
-
sys.stderr.flush()
|
|
48
|
-
return sys.stdin.readline().strip()
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def add_new_command(commands, category=None):
|
|
52
|
-
"""Handles the UI and logic for adding a new command."""
|
|
53
|
-
target_cat = category or prompt_user("Enter Category Name")
|
|
54
|
-
name = prompt_user("Enter Display Name")
|
|
55
|
-
cmd = prompt_user("Enter Bash Command")
|
|
56
|
-
|
|
57
|
-
if target_cat and name and cmd:
|
|
58
|
-
commands.append([target_cat, name, cmd])
|
|
59
|
-
save_commands(commands)
|
|
60
|
-
print(f"echo '✅ Added to {target_cat}'")
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def delete_category(commands):
|
|
64
|
-
"""Handles wiping an entire category."""
|
|
65
|
-
categories = sorted(list(set(c[0] for c in commands)))
|
|
66
|
-
if not categories:
|
|
67
|
-
print("echo 'No categories to delete!'")
|
|
68
|
-
return commands
|
|
69
|
-
|
|
70
|
-
cat_to_wipe = run_fzf(categories, "SELECT CATEGORY TO WIPE ENTIRELY")
|
|
71
|
-
if cat_to_wipe:
|
|
72
|
-
conf = prompt_user(f"Delete ALL commands in [{cat_to_wipe}]? (y/n)")
|
|
73
|
-
if conf.lower() == "y":
|
|
74
|
-
commands = [c for c in commands if c[0] != cat_to_wipe]
|
|
75
|
-
save_commands(commands)
|
|
76
|
-
print(f"echo '❌ Category [{cat_to_wipe}] deleted!'")
|
|
77
|
-
return commands
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def main():
|
|
81
|
-
"""Main function - Orchestrates the menu navigation."""
|
|
82
|
-
while True:
|
|
83
|
-
commands = load_commands()
|
|
84
|
-
categories = sorted(list(set(c[0] for c in commands)))
|
|
85
|
-
|
|
86
|
-
# 1. CATEGORY LEVEL
|
|
87
|
-
cat_options = categories + ["[+ Add New Category]", "[- Delete Category]"]
|
|
88
|
-
category = run_fzf(cat_options, "Select Category (Esc to Exit)")
|
|
89
|
-
|
|
90
|
-
if not category:
|
|
91
|
-
sys.exit(0)
|
|
92
|
-
|
|
93
|
-
if category == "[+ Add New Category]":
|
|
94
|
-
add_new_command(commands)
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
if category == "[- Delete Category]":
|
|
98
|
-
delete_category(commands)
|
|
99
|
-
return
|
|
100
|
-
|
|
101
|
-
# 2. COMMAND LEVEL
|
|
102
|
-
sub_cmds = [c for c in commands if c[0] == category]
|
|
103
|
-
cmd_options = [f"{c[1]}|{c[2]}" for c in sub_cmds]
|
|
104
|
-
cmd_options += [f"[+ Add Command to {category}]"]
|
|
105
|
-
|
|
106
|
-
selection = run_fzf(cmd_options, f"Commands in {category}")
|
|
107
|
-
|
|
108
|
-
if not selection:
|
|
109
|
-
continue
|
|
110
|
-
|
|
111
|
-
if selection == f"[+ Add Command to {category}]":
|
|
112
|
-
add_new_command(commands, category)
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
# 3. EXECUTE
|
|
116
|
-
print(selection.split("|", maxsplit=-1)[-1])
|
|
117
|
-
break
|
|
File without changes
|
|
File without changes
|
|
File without changes
|