it2 0.1.2__py3-none-any.whl
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.
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: it2
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A powerful command-line interface for controlling iTerm2
|
|
5
|
+
Project-URL: Homepage, https://github.com/mkusaka/it2
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/mkusaka/it2/issues
|
|
7
|
+
Project-URL: Documentation, https://github.com/mkusaka/it2#readme
|
|
8
|
+
Project-URL: Source Code, https://github.com/mkusaka/it2
|
|
9
|
+
Project-URL: PyPI, https://pypi.org/project/it2/
|
|
10
|
+
Author-email: Your Name <your.email@example.com>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: automation,cli,iterm2,macos,terminal
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Requires-Dist: click>=8.0
|
|
27
|
+
Requires-Dist: iterm2>=2.7
|
|
28
|
+
Requires-Dist: pyyaml>=6.0
|
|
29
|
+
Requires-Dist: rich>=10.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: black>=22.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: build>=1.0.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-asyncio>=0.20; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: ruff>=0.0.240; extra == 'dev'
|
|
38
|
+
Requires-Dist: twine==6.0.1; extra == 'dev'
|
|
39
|
+
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# it2
|
|
43
|
+
|
|
44
|
+
A powerful command-line interface for controlling iTerm2 using its Python API.
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- **Session Management**: Send text, execute commands, split panes, manage sessions
|
|
49
|
+
- **Window Control**: Create, move, resize, and manage windows
|
|
50
|
+
- **Tab Operations**: Create and navigate between tabs
|
|
51
|
+
- **Profile Management**: List, create, and apply iTerm2 profiles
|
|
52
|
+
- **Broadcasting**: Send input to multiple sessions simultaneously
|
|
53
|
+
- **Monitoring**: Watch session output, keystrokes, and variables in real-time
|
|
54
|
+
- **Configuration**: Define custom profiles and aliases in YAML
|
|
55
|
+
- **Shortcuts**: Quick access to common commands
|
|
56
|
+
|
|
57
|
+
## Requirements
|
|
58
|
+
|
|
59
|
+
- macOS with iTerm2 3.3.0 or later
|
|
60
|
+
- Python 3.8+
|
|
61
|
+
- iTerm2 Python API enabled (Preferences > General > Magic > Enable Python API)
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
### Using pip
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install it2
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Using uvx (recommended)
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
uvx it2
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Quick Start
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Send text to current session
|
|
81
|
+
it2 send "Hello, World!"
|
|
82
|
+
|
|
83
|
+
# Run a command
|
|
84
|
+
it2 run "ls -la"
|
|
85
|
+
|
|
86
|
+
# Split the current pane vertically
|
|
87
|
+
it2 vsplit
|
|
88
|
+
|
|
89
|
+
# Create a new window
|
|
90
|
+
it2 new
|
|
91
|
+
|
|
92
|
+
# List all sessions
|
|
93
|
+
it2 ls
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Basic Usage
|
|
97
|
+
|
|
98
|
+
### Session Operations
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Send text (without newline)
|
|
102
|
+
it2 session send "text"
|
|
103
|
+
it2 send "text" # shortcut
|
|
104
|
+
|
|
105
|
+
# Execute command (with newline)
|
|
106
|
+
it2 session run "command"
|
|
107
|
+
it2 run "command" # shortcut
|
|
108
|
+
|
|
109
|
+
# Target specific session or all sessions
|
|
110
|
+
it2 send "text" --session <id>
|
|
111
|
+
it2 send "text" --all
|
|
112
|
+
|
|
113
|
+
# Split panes
|
|
114
|
+
it2 session split # horizontal split
|
|
115
|
+
it2 session split -v # vertical split
|
|
116
|
+
it2 vsplit # shortcut for vertical split
|
|
117
|
+
|
|
118
|
+
# Session management
|
|
119
|
+
it2 session list # list all sessions
|
|
120
|
+
it2 session close # close current session
|
|
121
|
+
it2 session restart # restart session
|
|
122
|
+
it2 session clear # clear screen
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Window Operations
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Window management
|
|
129
|
+
it2 window new # create new window
|
|
130
|
+
it2 window list # list all windows
|
|
131
|
+
it2 window close # close current window
|
|
132
|
+
it2 window focus <id> # focus specific window
|
|
133
|
+
|
|
134
|
+
# Window manipulation
|
|
135
|
+
it2 window move 100 200 # move to position
|
|
136
|
+
it2 window resize 800 600 # resize window
|
|
137
|
+
it2 window fullscreen on # enable fullscreen
|
|
138
|
+
|
|
139
|
+
# Window arrangements
|
|
140
|
+
it2 window arrange save "dev" # save arrangement
|
|
141
|
+
it2 window arrange restore "dev" # restore arrangement
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Tab Operations
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Tab management
|
|
148
|
+
it2 tab new # create new tab
|
|
149
|
+
it2 tab list # list all tabs
|
|
150
|
+
it2 tab close # close current tab
|
|
151
|
+
it2 tab select <id> # select specific tab
|
|
152
|
+
|
|
153
|
+
# Tab navigation
|
|
154
|
+
it2 tab next # go to next tab
|
|
155
|
+
it2 tab prev # go to previous tab
|
|
156
|
+
it2 tab goto 2 # go to tab by index
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Profile Operations
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Profile management
|
|
163
|
+
it2 profile list # list all profiles
|
|
164
|
+
it2 profile show "Default" # show profile details
|
|
165
|
+
it2 profile create "MyProfile" --base "Default"
|
|
166
|
+
it2 profile apply "MyProfile"
|
|
167
|
+
|
|
168
|
+
# Profile configuration
|
|
169
|
+
it2 profile set "MyProfile" font-size 14
|
|
170
|
+
it2 profile set "MyProfile" bg-color "#000000"
|
|
171
|
+
it2 profile set "MyProfile" transparency 0.9
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Application Control
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# App management
|
|
178
|
+
it2 app activate # bring iTerm2 to front
|
|
179
|
+
it2 app hide # hide iTerm2
|
|
180
|
+
it2 app theme dark # set theme
|
|
181
|
+
|
|
182
|
+
# Broadcasting
|
|
183
|
+
it2 app broadcast on # enable broadcasting
|
|
184
|
+
it2 app broadcast off # disable broadcasting
|
|
185
|
+
it2 app broadcast add session1 session2 # create broadcast group
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Monitoring
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Monitor output
|
|
192
|
+
it2 monitor output -f # follow output
|
|
193
|
+
it2 monitor output -f -p "ERROR" # filter by pattern
|
|
194
|
+
|
|
195
|
+
# Monitor keystrokes
|
|
196
|
+
it2 monitor keystroke # all keystrokes
|
|
197
|
+
it2 monitor keystroke -p "^[a-z]+$" # filter by regex
|
|
198
|
+
|
|
199
|
+
# Monitor variables
|
|
200
|
+
it2 monitor variable lastCommand # session variable
|
|
201
|
+
it2 monitor variable buildNumber --app # app variable
|
|
202
|
+
|
|
203
|
+
# Monitor prompts (requires shell integration)
|
|
204
|
+
it2 monitor prompt
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Configuration
|
|
208
|
+
|
|
209
|
+
Create `~/.it2rc.yaml` to define custom profiles and aliases:
|
|
210
|
+
|
|
211
|
+
```yaml
|
|
212
|
+
# Custom profiles
|
|
213
|
+
profiles:
|
|
214
|
+
dev:
|
|
215
|
+
- command: cd ~/project
|
|
216
|
+
- split: vertical
|
|
217
|
+
- pane1: npm run dev
|
|
218
|
+
- pane2: npm test --watch
|
|
219
|
+
|
|
220
|
+
servers:
|
|
221
|
+
- split: 2x2
|
|
222
|
+
- pane1: ssh server1
|
|
223
|
+
- pane2: ssh server2
|
|
224
|
+
- pane3: ssh server3
|
|
225
|
+
- pane4: ssh server4
|
|
226
|
+
|
|
227
|
+
# Command aliases
|
|
228
|
+
aliases:
|
|
229
|
+
deploy: session run "deploy.sh" --all
|
|
230
|
+
logs: monitor output -f -p "ERROR|WARN"
|
|
231
|
+
dev-setup: load dev
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Use configurations:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Load a profile
|
|
238
|
+
it2 load dev
|
|
239
|
+
|
|
240
|
+
# Execute an alias
|
|
241
|
+
it2 alias deploy
|
|
242
|
+
|
|
243
|
+
# Show config path
|
|
244
|
+
it2 config-path
|
|
245
|
+
|
|
246
|
+
# Reload configuration
|
|
247
|
+
it2 config-reload
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Advanced Examples
|
|
251
|
+
|
|
252
|
+
### Development Environment Setup
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Create a development workspace
|
|
256
|
+
it2 window new --profile "Development"
|
|
257
|
+
it2 split
|
|
258
|
+
it2 send "cd ~/project && npm run dev"
|
|
259
|
+
it2 session focus 2
|
|
260
|
+
it2 send "cd ~/project && npm test --watch"
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Multi-Server Management
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# SSH to multiple servers with broadcasting
|
|
267
|
+
it2 tab new
|
|
268
|
+
it2 split && it2 split && it2 split
|
|
269
|
+
it2 app broadcast on
|
|
270
|
+
it2 send "ssh production-server"
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Automated Deployment
|
|
274
|
+
|
|
275
|
+
Create a deployment script:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
#!/bin/bash
|
|
279
|
+
# deploy.sh
|
|
280
|
+
|
|
281
|
+
# Create deployment window
|
|
282
|
+
it2 window new --profile "Deploy"
|
|
283
|
+
|
|
284
|
+
# Split for monitoring
|
|
285
|
+
it2 split -v
|
|
286
|
+
|
|
287
|
+
# Start deployment in first pane
|
|
288
|
+
it2 send "cd ~/project && ./deploy-prod.sh"
|
|
289
|
+
|
|
290
|
+
# Monitor logs in second pane
|
|
291
|
+
it2 session focus 2
|
|
292
|
+
it2 run "tail -f /var/log/deploy.log"
|
|
293
|
+
|
|
294
|
+
# Watch for errors
|
|
295
|
+
it2 monitor output -f -p "ERROR|FAILED"
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Environment Variables
|
|
299
|
+
|
|
300
|
+
- `IT2_DEFAULT_PROFILE`: Default profile name
|
|
301
|
+
- `IT2_CONFIG_PATH`: Path to configuration file (default: `~/.it2rc.yaml`)
|
|
302
|
+
- `IT2_TIMEOUT`: Command timeout in seconds
|
|
303
|
+
|
|
304
|
+
## Error Codes
|
|
305
|
+
|
|
306
|
+
- `0`: Success
|
|
307
|
+
- `1`: General error
|
|
308
|
+
- `2`: Connection error (iTerm2 not running or API not enabled)
|
|
309
|
+
- `3`: Target not found (session/window/tab not found)
|
|
310
|
+
- `4`: Invalid arguments
|
|
311
|
+
|
|
312
|
+
## Development
|
|
313
|
+
|
|
314
|
+
### Setup Development Environment
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
# Clone the repository
|
|
318
|
+
git clone https://github.com/mkusaka/it2.git
|
|
319
|
+
cd it2
|
|
320
|
+
|
|
321
|
+
# Create virtual environment
|
|
322
|
+
python -m venv venv
|
|
323
|
+
source venv/bin/activate
|
|
324
|
+
|
|
325
|
+
# Install in development mode
|
|
326
|
+
pip install -e ".[dev]"
|
|
327
|
+
|
|
328
|
+
# Run tests
|
|
329
|
+
pytest
|
|
330
|
+
|
|
331
|
+
# Run linting
|
|
332
|
+
ruff check .
|
|
333
|
+
black --check .
|
|
334
|
+
mypy .
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Project Structure
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
it2/
|
|
341
|
+
├── src/
|
|
342
|
+
│ └── it2/
|
|
343
|
+
│ ├── __init__.py
|
|
344
|
+
│ ├── cli.py # Main CLI entry point
|
|
345
|
+
│ ├── commands/ # Command modules
|
|
346
|
+
│ │ ├── session.py
|
|
347
|
+
│ │ ├── window.py
|
|
348
|
+
│ │ ├── tab.py
|
|
349
|
+
│ │ ├── profile.py
|
|
350
|
+
│ │ ├── app.py
|
|
351
|
+
│ │ ├── monitor.py
|
|
352
|
+
│ │ ├── shortcuts.py
|
|
353
|
+
│ │ └── config_commands.py
|
|
354
|
+
│ ├── core/ # Core functionality
|
|
355
|
+
│ │ ├── connection.py
|
|
356
|
+
│ │ ├── session_handler.py
|
|
357
|
+
│ │ └── errors.py
|
|
358
|
+
│ └── utils/ # Utilities
|
|
359
|
+
│ └── config.py
|
|
360
|
+
├── tests/ # Test files
|
|
361
|
+
├── pyproject.toml # Project configuration
|
|
362
|
+
├── README.md # This file
|
|
363
|
+
└── example.it2rc.yaml # Example configuration
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## Contributing
|
|
367
|
+
|
|
368
|
+
1. Fork the repository
|
|
369
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
370
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
371
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
372
|
+
5. Open a Pull Request
|
|
373
|
+
|
|
374
|
+
## License
|
|
375
|
+
|
|
376
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
377
|
+
|
|
378
|
+
## Acknowledgments
|
|
379
|
+
|
|
380
|
+
- Built on the [iTerm2 Python API](https://iterm2.com/python-api/)
|
|
381
|
+
- Inspired by tmux and screen command-line interfaces
|
|
382
|
+
- Uses [Click](https://click.palletsprojects.com/) for CLI framework
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
it2-0.1.2.dist-info/METADATA,sha256=u12VhVO7SH_osMowT6oHTeYyUsJVUZewl2Rzjj8frac,9514
|
|
2
|
+
it2-0.1.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
3
|
+
it2-0.1.2.dist-info/entry_points.txt,sha256=mO_Y4C3n1yOslQ4PTUS1ZyicuSapG5RHv7U6EE3XAig,37
|
|
4
|
+
it2-0.1.2.dist-info/licenses/LICENSE,sha256=MC51kshXD_mJOispI5rnNXgKASAgERY5pVKvEWzVbLk,1063
|
|
5
|
+
it2-0.1.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 mkusaka
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|