iterm2-focus 0.0.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.
- iterm2_focus-0.0.1/.github/workflows/ci.yml +123 -0
- iterm2_focus-0.0.1/.gitignore +218 -0
- iterm2_focus-0.0.1/CONTRIBUTING.md +132 -0
- iterm2_focus-0.0.1/LICENSE +21 -0
- iterm2_focus-0.0.1/PKG-INFO +209 -0
- iterm2_focus-0.0.1/README.md +167 -0
- iterm2_focus-0.0.1/pyproject.toml +159 -0
- iterm2_focus-0.0.1/src/iterm2_focus/__init__.py +19 -0
- iterm2_focus-0.0.1/src/iterm2_focus/cli.py +199 -0
- iterm2_focus-0.0.1/src/iterm2_focus/focus.py +71 -0
- iterm2_focus-0.0.1/src/iterm2_focus/py.typed +2 -0
- iterm2_focus-0.0.1/src/iterm2_focus/utils.py +145 -0
- iterm2_focus-0.0.1/tests/__init__.py +1 -0
- iterm2_focus-0.0.1/tests/test_cli.py +186 -0
- iterm2_focus-0.0.1/tests/test_focus.py +107 -0
- iterm2_focus-0.0.1/tests/test_utils.py +252 -0
- iterm2_focus-0.0.1/uv.lock +1289 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
concurrency:
|
|
8
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
9
|
+
cancel-in-progress: true
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
lint:
|
|
13
|
+
name: Lint
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up uv
|
|
20
|
+
uses: astral-sh/setup-uv@v6
|
|
21
|
+
with:
|
|
22
|
+
enable-cache: true
|
|
23
|
+
cache-dependency-glob: "uv.lock"
|
|
24
|
+
|
|
25
|
+
- name: Set up Python
|
|
26
|
+
run: uv python install 3.13
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: uv sync --all-extras --dev
|
|
30
|
+
|
|
31
|
+
- name: Run ruff
|
|
32
|
+
run: |
|
|
33
|
+
uv run ruff check src tests
|
|
34
|
+
uv run ruff format --check src tests
|
|
35
|
+
|
|
36
|
+
- name: Run black
|
|
37
|
+
run: uv run black --check src tests
|
|
38
|
+
|
|
39
|
+
- name: Run mypy
|
|
40
|
+
run: uv run mypy src
|
|
41
|
+
|
|
42
|
+
test:
|
|
43
|
+
name: Test Python ${{ matrix.python-version }}
|
|
44
|
+
runs-on: ${{ matrix.os }}
|
|
45
|
+
strategy:
|
|
46
|
+
fail-fast: false
|
|
47
|
+
matrix:
|
|
48
|
+
os: [macos-latest]
|
|
49
|
+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
50
|
+
steps:
|
|
51
|
+
- name: Checkout code
|
|
52
|
+
uses: actions/checkout@v4
|
|
53
|
+
|
|
54
|
+
- name: Set up uv
|
|
55
|
+
uses: astral-sh/setup-uv@v6
|
|
56
|
+
with:
|
|
57
|
+
enable-cache: true
|
|
58
|
+
cache-dependency-glob: "uv.lock"
|
|
59
|
+
|
|
60
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
61
|
+
run: uv python install ${{ matrix.python-version }}
|
|
62
|
+
|
|
63
|
+
- name: Install dependencies
|
|
64
|
+
run: uv sync --all-extras --dev
|
|
65
|
+
|
|
66
|
+
- name: Run tests
|
|
67
|
+
run: uv run pytest -v --cov=iterm2_focus --cov-report=xml --cov-report=term
|
|
68
|
+
|
|
69
|
+
- name: Upload coverage to Codecov
|
|
70
|
+
if: matrix.python-version == '3.13'
|
|
71
|
+
uses: codecov/codecov-action@v5
|
|
72
|
+
with:
|
|
73
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
74
|
+
file: ./coverage.xml
|
|
75
|
+
flags: unittests
|
|
76
|
+
name: codecov-umbrella
|
|
77
|
+
|
|
78
|
+
build:
|
|
79
|
+
name: Build distribution
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
steps:
|
|
82
|
+
- name: Checkout code
|
|
83
|
+
uses: actions/checkout@v4
|
|
84
|
+
|
|
85
|
+
- name: Set up uv
|
|
86
|
+
uses: astral-sh/setup-uv@v6
|
|
87
|
+
with:
|
|
88
|
+
enable-cache: true
|
|
89
|
+
cache-dependency-glob: "uv.lock"
|
|
90
|
+
|
|
91
|
+
- name: Build package
|
|
92
|
+
run: uv build
|
|
93
|
+
|
|
94
|
+
- name: Upload artifacts
|
|
95
|
+
uses: actions/upload-artifact@v4
|
|
96
|
+
with:
|
|
97
|
+
name: dist
|
|
98
|
+
path: dist/
|
|
99
|
+
|
|
100
|
+
- name: Check dist
|
|
101
|
+
run: |
|
|
102
|
+
ls -la dist/
|
|
103
|
+
uv run twine check dist/*
|
|
104
|
+
|
|
105
|
+
publish:
|
|
106
|
+
name: Publish to PyPI
|
|
107
|
+
needs: [lint, test, build]
|
|
108
|
+
runs-on: ubuntu-latest
|
|
109
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
110
|
+
environment:
|
|
111
|
+
name: pypi
|
|
112
|
+
url: https://pypi.org/p/iterm2-focus
|
|
113
|
+
permissions:
|
|
114
|
+
id-token: write
|
|
115
|
+
steps:
|
|
116
|
+
- name: Download artifacts
|
|
117
|
+
uses: actions/download-artifact@v4
|
|
118
|
+
with:
|
|
119
|
+
name: dist
|
|
120
|
+
path: dist/
|
|
121
|
+
|
|
122
|
+
- name: Publish to PyPI
|
|
123
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
208
|
+
|
|
209
|
+
# IDEs
|
|
210
|
+
.idea/
|
|
211
|
+
.vscode/
|
|
212
|
+
*.swp
|
|
213
|
+
*.swo
|
|
214
|
+
*~
|
|
215
|
+
.DS_Store
|
|
216
|
+
|
|
217
|
+
# uv
|
|
218
|
+
.uv/
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Contributing to iterm2-focus
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to iterm2-focus! This document provides guidelines and instructions for contributing.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
1. **Fork and clone the repository**
|
|
8
|
+
```bash
|
|
9
|
+
git clone https://github.com/YOUR-USERNAME/iterm2-focus
|
|
10
|
+
cd iterm2-focus
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. **Install uv (if not already installed)**
|
|
14
|
+
```bash
|
|
15
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
3. **Create a virtual environment and install dependencies**
|
|
19
|
+
```bash
|
|
20
|
+
uv venv
|
|
21
|
+
uv sync --all-extras --dev
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
4. **Install pre-commit hooks (optional but recommended)**
|
|
25
|
+
```bash
|
|
26
|
+
uv run pre-commit install
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Running Tests
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Run all tests
|
|
33
|
+
uv run pytest
|
|
34
|
+
|
|
35
|
+
# Run with coverage
|
|
36
|
+
uv run pytest --cov=iterm2_focus
|
|
37
|
+
|
|
38
|
+
# Run specific test file
|
|
39
|
+
uv run pytest tests/test_focus.py
|
|
40
|
+
|
|
41
|
+
# Run with verbose output
|
|
42
|
+
uv run pytest -v
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Code Quality
|
|
46
|
+
|
|
47
|
+
Before submitting a pull request, ensure your code passes all quality checks:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Format code
|
|
51
|
+
uv run black src tests
|
|
52
|
+
uv run ruff format src tests
|
|
53
|
+
|
|
54
|
+
# Check linting
|
|
55
|
+
uv run ruff check src tests
|
|
56
|
+
|
|
57
|
+
# Type checking
|
|
58
|
+
uv run mypy src
|
|
59
|
+
|
|
60
|
+
# Run all checks at once
|
|
61
|
+
uv run black src tests && uv run ruff check src tests && uv run mypy src && uv run pytest
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Testing the CLI
|
|
65
|
+
|
|
66
|
+
During development, you can test the CLI using:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Using uv run
|
|
70
|
+
uv run isf --help
|
|
71
|
+
uv run isf --list
|
|
72
|
+
|
|
73
|
+
# Or activate the virtual environment
|
|
74
|
+
source .venv/bin/activate
|
|
75
|
+
isf --help
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Pull Request Process
|
|
79
|
+
|
|
80
|
+
1. **Create a feature branch**
|
|
81
|
+
```bash
|
|
82
|
+
git checkout -b feature/your-feature-name
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
2. **Make your changes**
|
|
86
|
+
- Write clear, concise commit messages
|
|
87
|
+
- Add tests for new functionality
|
|
88
|
+
- Update documentation as needed
|
|
89
|
+
|
|
90
|
+
3. **Ensure all tests pass**
|
|
91
|
+
```bash
|
|
92
|
+
uv run pytest
|
|
93
|
+
uv run mypy src
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
4. **Push your branch and create a pull request**
|
|
97
|
+
- Provide a clear description of your changes
|
|
98
|
+
- Reference any related issues
|
|
99
|
+
- Ensure CI passes
|
|
100
|
+
|
|
101
|
+
## Code Style
|
|
102
|
+
|
|
103
|
+
- Follow PEP 8
|
|
104
|
+
- Use type hints for all functions
|
|
105
|
+
- Maximum line length: 88 characters (Black default)
|
|
106
|
+
- Use descriptive variable and function names
|
|
107
|
+
|
|
108
|
+
## Testing Guidelines
|
|
109
|
+
|
|
110
|
+
- Write tests for all new functionality
|
|
111
|
+
- Maintain or improve code coverage
|
|
112
|
+
- Use pytest fixtures for test setup
|
|
113
|
+
- Mock external dependencies (especially iTerm2 API calls)
|
|
114
|
+
|
|
115
|
+
## Documentation
|
|
116
|
+
|
|
117
|
+
- Update README.md if adding new features
|
|
118
|
+
- Add docstrings to all public functions and classes
|
|
119
|
+
- Include type hints in function signatures
|
|
120
|
+
|
|
121
|
+
## Release Process
|
|
122
|
+
|
|
123
|
+
Releases are automated through GitHub Actions:
|
|
124
|
+
|
|
125
|
+
1. Update version in `pyproject.toml` and `src/iterm2_focus/__init__.py`
|
|
126
|
+
2. Create a PR with version changes
|
|
127
|
+
3. After merging, create a GitHub release with tag `v{version}`
|
|
128
|
+
4. CI will automatically publish to PyPI
|
|
129
|
+
|
|
130
|
+
## Questions?
|
|
131
|
+
|
|
132
|
+
Feel free to open an issue for any questions or concerns!
|
|
@@ -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.
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iterm2-focus
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Focus iTerm2 sessions by ID
|
|
5
|
+
Project-URL: Homepage, https://github.com/mkusaka/iterm2-focus
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/mkusaka/iterm2-focus/issues
|
|
7
|
+
Project-URL: Documentation, https://github.com/mkusaka/iterm2-focus#readme
|
|
8
|
+
Project-URL: Source Code, https://github.com/mkusaka/iterm2-focus
|
|
9
|
+
Author-email: mkusaka <hinoshita1992@gmail.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: cli,focus,iterm2,macos,terminal
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Environment :: MacOS X
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Operating System :: MacOS
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Topic :: Terminals
|
|
26
|
+
Classifier: Topic :: Utilities
|
|
27
|
+
Classifier: Typing :: Typed
|
|
28
|
+
Requires-Python: >=3.8
|
|
29
|
+
Requires-Dist: click>=8.1.0
|
|
30
|
+
Requires-Dist: iterm2>=2.7
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: mypy>=1.5.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-mock>=3.11.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: twine>=5.0.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: types-click>=7.1.0; extra == 'dev'
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
# iterm2-focus
|
|
44
|
+
|
|
45
|
+
Focus iTerm2 sessions by ID from the command line.
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- Focus any iTerm2 session by its ID
|
|
50
|
+
- Get the current session ID
|
|
51
|
+
- List all available sessions
|
|
52
|
+
- Focus the current session (useful when returning from other applications)
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install iterm2-focus
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Or using [uv](https://github.com/astral-sh/uv):
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
uv pip install iterm2-focus
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Prerequisites
|
|
67
|
+
|
|
68
|
+
1. **macOS** with iTerm2 installed
|
|
69
|
+
2. **Python 3.8** or later
|
|
70
|
+
3. **iTerm2 Python API** must be enabled:
|
|
71
|
+
- Open iTerm2
|
|
72
|
+
- Go to *Settings* → *General* → *Magic*
|
|
73
|
+
- Check "Enable Python API"
|
|
74
|
+
- Restart iTerm2
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
### Focus a specific session
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
isf w0t0p0:12345678-1234-1234-1234-123456789012
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Focus the current session
|
|
85
|
+
|
|
86
|
+
Useful when returning from another application:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
isf --current
|
|
90
|
+
# or
|
|
91
|
+
isf -c
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Get the current session ID
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
isf --get-current
|
|
98
|
+
# or
|
|
99
|
+
isf -g
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### List all sessions
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
isf --list
|
|
106
|
+
# or
|
|
107
|
+
isf -l
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Additional options
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Show version
|
|
114
|
+
isf --version
|
|
115
|
+
|
|
116
|
+
# Quiet mode (suppress output)
|
|
117
|
+
isf -q <session-id>
|
|
118
|
+
|
|
119
|
+
# Help
|
|
120
|
+
isf --help
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Examples
|
|
124
|
+
|
|
125
|
+
### Save and restore focus
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Save current session ID
|
|
129
|
+
SAVED_SESSION=$(isf -g -q)
|
|
130
|
+
|
|
131
|
+
# ... do other work ...
|
|
132
|
+
|
|
133
|
+
# Return to saved session
|
|
134
|
+
isf $SAVED_SESSION
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Focus a session from another application
|
|
138
|
+
|
|
139
|
+
```applescript
|
|
140
|
+
-- AppleScript example
|
|
141
|
+
do shell script "isf w0t0p0:12345678-1234-1234-1234-123456789012"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Development
|
|
145
|
+
|
|
146
|
+
### Setup
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Clone the repository
|
|
150
|
+
git clone https://github.com/mkusaka/iterm2-focus
|
|
151
|
+
cd iterm2-focus
|
|
152
|
+
|
|
153
|
+
# Create virtual environment with uv
|
|
154
|
+
uv venv
|
|
155
|
+
uv pip install -e ".[dev]"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Testing
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Run tests
|
|
162
|
+
uv run pytest
|
|
163
|
+
|
|
164
|
+
# Run tests with coverage
|
|
165
|
+
uv run pytest --cov=iterm2_focus
|
|
166
|
+
|
|
167
|
+
# Type checking
|
|
168
|
+
uv run mypy src
|
|
169
|
+
|
|
170
|
+
# Linting and formatting
|
|
171
|
+
uv run ruff check src tests
|
|
172
|
+
uv run black src tests
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Building
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Build the package
|
|
179
|
+
uv build
|
|
180
|
+
|
|
181
|
+
# Upload to PyPI
|
|
182
|
+
uv publish
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
188
|
+
|
|
189
|
+
## Contributing
|
|
190
|
+
|
|
191
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
192
|
+
|
|
193
|
+
## Troubleshooting
|
|
194
|
+
|
|
195
|
+
### "Failed to connect to iTerm2" error
|
|
196
|
+
|
|
197
|
+
Make sure iTerm2's Python API is enabled (see Prerequisites).
|
|
198
|
+
|
|
199
|
+
### "Session not found" error
|
|
200
|
+
|
|
201
|
+
Verify the session ID using `isf --list` to see all available sessions.
|
|
202
|
+
|
|
203
|
+
### Permission errors
|
|
204
|
+
|
|
205
|
+
On first run, macOS may ask for permission to control iTerm2. Please allow this in System Preferences.
|
|
206
|
+
|
|
207
|
+
## Author
|
|
208
|
+
|
|
209
|
+
mkusaka <hinoshita1992@gmail.com>
|