compose-lazy 0.7.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.
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Hiro Ito
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: compose-lazy
3
+ Version: 0.7.0
4
+ Summary: A smart CLI wrapper for docker compose with interactive selection support.
5
+ Keywords: docker,docker compose,alias,command line tool,productivity
6
+ Author-email: Hiro Ito <mobiiii24@gmail.com>
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-Expression: MIT
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Natural Language :: English
13
+ Classifier: Topic :: Utilities
14
+ Classifier: Environment :: Console
15
+ Classifier: Operating System :: Microsoft :: Windows :: Windows 11
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ License-File: LICENSE
24
+ Requires-Dist: pyyaml>=6.0.3
25
+ Project-URL: Issues, https://github.com/HiroItozzz/compose-lazy/issues
26
+ Project-URL: Repository, https://github.com/HiroItozzz/compose-lazy
27
+
28
+ # Compose Lazy
29
+ > πŸš€ A smart CLI wrapper for `docker compose` β€” with interactive file, profile, and service selection.
30
+
31
+ ## Overview
32
+ A CLI tool designed to streamline workflows for developers who frequently use `docker compose`.
33
+ In addition to short aliases for common commands, it features interactive selection of compose files, profiles, and services, and multi-repository workspace management.
34
+ Available on PyPI β€” install instantly with `pipx install compose-lazy` or `uv tool install compose-lazy`.
35
+
36
+ [ζ—₯本θͺžη‰ˆREADME](README_ja.md)γ‚‚γ‚γ‚ŠγΎγ™γ€‚
37
+
38
+ ## Highlights
39
+
40
+ ### Basic Commands
41
+ Installing compose-lazy adds three commands to your PATH automatically.
42
+
43
+ | Command | Description |
44
+ |---|---|
45
+ | `dcpu` | Alias for `docker compose up` |
46
+ | `dcpe` | Alias for `docker compose exec` |
47
+ | `dcp` | Alias for other subcommands (`build`, `logs`, `stop`, etc.) |
48
+
49
+ Each command supports multiple options. See the [List of Commands](#list-of-commands) for details.
50
+
51
+
52
+ ### Multi-Repo Workspace
53
+ Register named groups of repositories as a *workspace* and operate all of them at once.
54
+
55
+ ```bash
56
+ # Register repositories to a workspace
57
+ $ dcp ws register
58
+ Please enter a new directory path: /path/to/repo
59
+ Please enter a new workspace name: myproject
60
+ β˜‘ Registered new path to myproject: /path/to/repo
61
+
62
+ # Launch all repos in a workspace
63
+ $ dcp ws up
64
+ β˜‘ Found 1 registered workspace.
65
+ 1. myproject
66
+ Enter your choice: 1
67
+ β–· Executing `docker compose up -d` in `/path/to/repo`.
68
+ ```
69
+
70
+ Workspace configuration is stored in `~/.config/compose-lazy`.
71
+
72
+
73
+ ### Interactive Selection
74
+ Running `-f`, `-pf`, or `-s` without arguments auto-detects compose files, profiles, and services, letting you choose interactively.
75
+
76
+ ```bash
77
+ $ dcpu -f
78
+ β˜‘ Found 2 compose files!
79
+ 1. docker-compose.yml
80
+ 2. docker-compose.prod.yml
81
+ Enter your choices (e.g., 1,3,4) or 'q' to quit: 2
82
+ β–· Executing `docker compose -f docker-compose.prod.yml up`.
83
+
84
+ $ dcp re -pf # `re`start
85
+ β˜‘ Found 2 profiles!
86
+ 1. dev
87
+ 2. prod
88
+ Enter your choices (e.g., 1,3,4) or 'q' to quit: 1
89
+ β–· Executing `docker compose --profile dev restart`.
90
+
91
+ $ dcp l -s # `l`ogs
92
+ β˜‘ Found 3 services!
93
+ 1. app
94
+ 2. db
95
+ 3. frontend
96
+ Enter your choices (e.g., 1,3,4) or 'q' to quit: 1,2
97
+ β–· Executing `docker compose logs app db`.
98
+ ```
99
+
100
+ For `exec`/`run`, interactive selection starts automatically when no service name is given.
101
+
102
+ ```bash
103
+ $ dcpe # `e`xec
104
+ β˜‘ Found 3 services!
105
+ 1. app
106
+ 2. db
107
+ 3. frontend
108
+ Enter your choice or 'q' to quit: 1
109
+ β–· Executing `docker compose exec app bash`.
110
+ ```
111
+
112
+
113
+ ## πŸ”§ Install compose-lazy
114
+ ### Quick Install
115
+ ```bash
116
+ # Using pipx
117
+ pipx install compose-lazy
118
+ # OR using uv
119
+ uv tool install compose-lazy
120
+ ```
121
+ ### Not familiar with Python tooling?
122
+
123
+ If you don't have `pipx` or `uv` installed yet:
124
+
125
+ <details>
126
+ <summary>Windows</summary>
127
+
128
+ ```bash
129
+ python -m pip install --user pipx
130
+ python -m pipx ensurepath
131
+ # Restart terminal, then:
132
+ pipx install compose-lazy
133
+ ```
134
+ </details>
135
+
136
+ <details>
137
+ <summary>macOS</summary>
138
+
139
+ ```bash
140
+ brew install pipx
141
+ pipx ensurepath
142
+ pipx install compose-lazy
143
+ ```
144
+ </details>
145
+
146
+ <details>
147
+ <summary>Linux (Ubuntu/Debian)</summary>
148
+
149
+ ```bash
150
+ pip install pipx
151
+ pipx ensurepath
152
+ pipx install compose-lazy
153
+ ```
154
+ </details>
155
+
156
+ ## Features
157
+
158
+ - **Interactive Selection**: auto-detect and interactively select compose files, profiles, and services
159
+ - **Multi-Repo Workspace**: run docker compose commands across multiple repositories at once with `dcp ws`
160
+ - **Short Aliases**: `dcp u`, `dcp b`, `dcp e` β€” fewer keystrokes for common commands
161
+ - **Dedicated Commands**: `dcpu` and `dcpe` for frequent up/exec workflows
162
+ - **Cross-Platform**: Works on Windows, macOS, and Linux
163
+
164
+ ## FAQ
165
+ ### Why use pipx or uv tool instead of pip?
166
+
167
+ Both `pipx` and `uv tool` install CLI tools in isolated environments, so compose-lazy won't conflict with other Python packages. The commands (`dcp`, `dcpu`, `dcpe`) are available globally without activating a virtual environment. `uv tool` is the faster alternative if you already use uv.
168
+
169
+ ## Requirements
170
+
171
+ - Python 3.11+
172
+ - Docker with Compose V2 (`docker compose` β€” not `docker-compose`)
173
+ - A `docker-compose.yml` (or `*compose*.yml/yaml`) in the current directory for interactive selection features
174
+
175
+ ## List of Commands
176
+
177
+ > **Common options** (available for all commands): `-s`, `-f FILE...`, `-pf PROFILE...`, `-p PROJECT`
178
+ >
179
+ > ⚠️ Note: `-f`, `-pf`, `-p` are passed before the subcommand in the actual docker compose syntax,
180
+ > but in compose-lazy they are specified after the subcommand (e.g. `dcp up -f FILE`).
181
+
182
+ | Bash Command | Executed Docker Command |
183
+ |--------------------------------------|----------------------------------------------------------|
184
+ | dcp | - (Show help) |
185
+ | dcpu [SERVICE...] [-d] [-b] [-w] | docker compose up [SERVICE...] |
186
+ | dcpe [SERVICE] | docker compose exec SERVICE bash |
187
+ | dcpe [SERVICE] [COMMANDS...] | docker compose exec SERVICE [COMMANDS...] |
188
+ | dcp up(u) [SERVICE...] | docker compose up [SERVICE...] |
189
+ | dcp up(u) -d | docker compose up -d |
190
+ | dcp up(u) -b | docker compose up --build |
191
+ | dcp up(u) -w | docker compose up --wait |
192
+ | dcp build(b) [SERVICE...] | docker compose build [SERVICE...] |
193
+ | dcp exec(e) [SERVICE] | docker compose exec SERVICE bash |
194
+ | dcp exec(e) [SERVICE] [COMMANDS...] | docker compose exec SERVICE [COMMANDS...] |
195
+ | dcp run [SERVICE] | docker compose run SERVICE bash |
196
+ | dcp restart(re) [SERVICE...] | docker compose restart [SERVICE...] |
197
+ | dcp ps [SERVICE...] [-a] [-st STATUS]| docker compose ps [SERVICE...] [--all] [--status ...] |
198
+ | dcp logs(l) [SERVICE...] [-fo] | docker compose logs [SERVICE...] [-f] |
199
+ | dcp stop(s) [SERVICE...] | docker compose stop [SERVICE...] |
200
+ | dcp down [-ro] | docker compose down [--remove-orphans] |
201
+ | dcp workspace(ws) register(reg) | Register a new repo to a workspace interactively |
202
+ | dcp workspace(ws) delete(del) | Delete a repo from a workspace interactively |
203
+ | dcp workspace(ws) list(li) | List all registered workspaces |
204
+ | dcp workspace(ws) up(u) | docker compose up -d for each repo in a workspace |
205
+ | dcp workspace(ws) restart(re) | docker compose restart for each repo in a workspace |
206
+ | dcp workspace(ws) stop(s) | docker compose stop for each repo in a workspace |
207
+ | dcp workspace(ws) down | docker compose down for each repo in a workspace |
208
+
209
+ and more... see `dcp --help` for the full list of supported commands and options.
210
+
211
+ ## License
212
+
213
+ MIT LICENSE
@@ -0,0 +1,186 @@
1
+ # Compose Lazy
2
+ > πŸš€ A smart CLI wrapper for `docker compose` β€” with interactive file, profile, and service selection.
3
+
4
+ ## Overview
5
+ A CLI tool designed to streamline workflows for developers who frequently use `docker compose`.
6
+ In addition to short aliases for common commands, it features interactive selection of compose files, profiles, and services, and multi-repository workspace management.
7
+ Available on PyPI β€” install instantly with `pipx install compose-lazy` or `uv tool install compose-lazy`.
8
+
9
+ [ζ—₯本θͺžη‰ˆREADME](README_ja.md)γ‚‚γ‚γ‚ŠγΎγ™γ€‚
10
+
11
+ ## Highlights
12
+
13
+ ### Basic Commands
14
+ Installing compose-lazy adds three commands to your PATH automatically.
15
+
16
+ | Command | Description |
17
+ |---|---|
18
+ | `dcpu` | Alias for `docker compose up` |
19
+ | `dcpe` | Alias for `docker compose exec` |
20
+ | `dcp` | Alias for other subcommands (`build`, `logs`, `stop`, etc.) |
21
+
22
+ Each command supports multiple options. See the [List of Commands](#list-of-commands) for details.
23
+
24
+
25
+ ### Multi-Repo Workspace
26
+ Register named groups of repositories as a *workspace* and operate all of them at once.
27
+
28
+ ```bash
29
+ # Register repositories to a workspace
30
+ $ dcp ws register
31
+ Please enter a new directory path: /path/to/repo
32
+ Please enter a new workspace name: myproject
33
+ β˜‘ Registered new path to myproject: /path/to/repo
34
+
35
+ # Launch all repos in a workspace
36
+ $ dcp ws up
37
+ β˜‘ Found 1 registered workspace.
38
+ 1. myproject
39
+ Enter your choice: 1
40
+ β–· Executing `docker compose up -d` in `/path/to/repo`.
41
+ ```
42
+
43
+ Workspace configuration is stored in `~/.config/compose-lazy`.
44
+
45
+
46
+ ### Interactive Selection
47
+ Running `-f`, `-pf`, or `-s` without arguments auto-detects compose files, profiles, and services, letting you choose interactively.
48
+
49
+ ```bash
50
+ $ dcpu -f
51
+ β˜‘ Found 2 compose files!
52
+ 1. docker-compose.yml
53
+ 2. docker-compose.prod.yml
54
+ Enter your choices (e.g., 1,3,4) or 'q' to quit: 2
55
+ β–· Executing `docker compose -f docker-compose.prod.yml up`.
56
+
57
+ $ dcp re -pf # `re`start
58
+ β˜‘ Found 2 profiles!
59
+ 1. dev
60
+ 2. prod
61
+ Enter your choices (e.g., 1,3,4) or 'q' to quit: 1
62
+ β–· Executing `docker compose --profile dev restart`.
63
+
64
+ $ dcp l -s # `l`ogs
65
+ β˜‘ Found 3 services!
66
+ 1. app
67
+ 2. db
68
+ 3. frontend
69
+ Enter your choices (e.g., 1,3,4) or 'q' to quit: 1,2
70
+ β–· Executing `docker compose logs app db`.
71
+ ```
72
+
73
+ For `exec`/`run`, interactive selection starts automatically when no service name is given.
74
+
75
+ ```bash
76
+ $ dcpe # `e`xec
77
+ β˜‘ Found 3 services!
78
+ 1. app
79
+ 2. db
80
+ 3. frontend
81
+ Enter your choice or 'q' to quit: 1
82
+ β–· Executing `docker compose exec app bash`.
83
+ ```
84
+
85
+
86
+ ## πŸ”§ Install compose-lazy
87
+ ### Quick Install
88
+ ```bash
89
+ # Using pipx
90
+ pipx install compose-lazy
91
+ # OR using uv
92
+ uv tool install compose-lazy
93
+ ```
94
+ ### Not familiar with Python tooling?
95
+
96
+ If you don't have `pipx` or `uv` installed yet:
97
+
98
+ <details>
99
+ <summary>Windows</summary>
100
+
101
+ ```bash
102
+ python -m pip install --user pipx
103
+ python -m pipx ensurepath
104
+ # Restart terminal, then:
105
+ pipx install compose-lazy
106
+ ```
107
+ </details>
108
+
109
+ <details>
110
+ <summary>macOS</summary>
111
+
112
+ ```bash
113
+ brew install pipx
114
+ pipx ensurepath
115
+ pipx install compose-lazy
116
+ ```
117
+ </details>
118
+
119
+ <details>
120
+ <summary>Linux (Ubuntu/Debian)</summary>
121
+
122
+ ```bash
123
+ pip install pipx
124
+ pipx ensurepath
125
+ pipx install compose-lazy
126
+ ```
127
+ </details>
128
+
129
+ ## Features
130
+
131
+ - **Interactive Selection**: auto-detect and interactively select compose files, profiles, and services
132
+ - **Multi-Repo Workspace**: run docker compose commands across multiple repositories at once with `dcp ws`
133
+ - **Short Aliases**: `dcp u`, `dcp b`, `dcp e` β€” fewer keystrokes for common commands
134
+ - **Dedicated Commands**: `dcpu` and `dcpe` for frequent up/exec workflows
135
+ - **Cross-Platform**: Works on Windows, macOS, and Linux
136
+
137
+ ## FAQ
138
+ ### Why use pipx or uv tool instead of pip?
139
+
140
+ Both `pipx` and `uv tool` install CLI tools in isolated environments, so compose-lazy won't conflict with other Python packages. The commands (`dcp`, `dcpu`, `dcpe`) are available globally without activating a virtual environment. `uv tool` is the faster alternative if you already use uv.
141
+
142
+ ## Requirements
143
+
144
+ - Python 3.11+
145
+ - Docker with Compose V2 (`docker compose` β€” not `docker-compose`)
146
+ - A `docker-compose.yml` (or `*compose*.yml/yaml`) in the current directory for interactive selection features
147
+
148
+ ## List of Commands
149
+
150
+ > **Common options** (available for all commands): `-s`, `-f FILE...`, `-pf PROFILE...`, `-p PROJECT`
151
+ >
152
+ > ⚠️ Note: `-f`, `-pf`, `-p` are passed before the subcommand in the actual docker compose syntax,
153
+ > but in compose-lazy they are specified after the subcommand (e.g. `dcp up -f FILE`).
154
+
155
+ | Bash Command | Executed Docker Command |
156
+ |--------------------------------------|----------------------------------------------------------|
157
+ | dcp | - (Show help) |
158
+ | dcpu [SERVICE...] [-d] [-b] [-w] | docker compose up [SERVICE...] |
159
+ | dcpe [SERVICE] | docker compose exec SERVICE bash |
160
+ | dcpe [SERVICE] [COMMANDS...] | docker compose exec SERVICE [COMMANDS...] |
161
+ | dcp up(u) [SERVICE...] | docker compose up [SERVICE...] |
162
+ | dcp up(u) -d | docker compose up -d |
163
+ | dcp up(u) -b | docker compose up --build |
164
+ | dcp up(u) -w | docker compose up --wait |
165
+ | dcp build(b) [SERVICE...] | docker compose build [SERVICE...] |
166
+ | dcp exec(e) [SERVICE] | docker compose exec SERVICE bash |
167
+ | dcp exec(e) [SERVICE] [COMMANDS...] | docker compose exec SERVICE [COMMANDS...] |
168
+ | dcp run [SERVICE] | docker compose run SERVICE bash |
169
+ | dcp restart(re) [SERVICE...] | docker compose restart [SERVICE...] |
170
+ | dcp ps [SERVICE...] [-a] [-st STATUS]| docker compose ps [SERVICE...] [--all] [--status ...] |
171
+ | dcp logs(l) [SERVICE...] [-fo] | docker compose logs [SERVICE...] [-f] |
172
+ | dcp stop(s) [SERVICE...] | docker compose stop [SERVICE...] |
173
+ | dcp down [-ro] | docker compose down [--remove-orphans] |
174
+ | dcp workspace(ws) register(reg) | Register a new repo to a workspace interactively |
175
+ | dcp workspace(ws) delete(del) | Delete a repo from a workspace interactively |
176
+ | dcp workspace(ws) list(li) | List all registered workspaces |
177
+ | dcp workspace(ws) up(u) | docker compose up -d for each repo in a workspace |
178
+ | dcp workspace(ws) restart(re) | docker compose restart for each repo in a workspace |
179
+ | dcp workspace(ws) stop(s) | docker compose stop for each repo in a workspace |
180
+ | dcp workspace(ws) down | docker compose down for each repo in a workspace |
181
+
182
+ and more... see `dcp --help` for the full list of supported commands and options.
183
+
184
+ ## License
185
+
186
+ MIT LICENSE
@@ -0,0 +1,66 @@
1
+ [build-system]
2
+ requires = ["flit_core >= 3.12.0, <5"]
3
+ build-backend = "flit_core.buildapi"
4
+
5
+ [project]
6
+ name = "compose-lazy"
7
+ version = "0.7.0"
8
+ authors = [{ name = "Hiro Ito", email = "mobiiii24@gmail.com" }]
9
+ keywords = ["docker", "docker compose", "alias", "command line tool", "productivity"]
10
+ readme = "README.md"
11
+ requires-python = ">=3.11"
12
+ dynamic = ["description"]
13
+ license = "MIT"
14
+ license-files = ["LICENSE"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "Natural Language :: English",
19
+ "Topic :: Utilities",
20
+ "Environment :: Console",
21
+ "Operating System :: Microsoft :: Windows :: Windows 11",
22
+ "Operating System :: MacOS",
23
+ "Operating System :: POSIX :: Linux",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Programming Language :: Python :: 3.14"
29
+ ]
30
+ dependencies = [
31
+ "pyyaml>=6.0.3",
32
+ ]
33
+
34
+ [project.scripts]
35
+ dcp = "compose_lazy.main:main"
36
+ dcpu = "compose_lazy.main:dcpu_main"
37
+ dcpe = "compose_lazy.main:dcpe_main"
38
+
39
+ [project.urls]
40
+ Repository = "https://github.com/HiroItozzz/compose-lazy"
41
+ Issues = "https://github.com/HiroItozzz/compose-lazy/issues"
42
+
43
+ [dependency-groups]
44
+ dev = [
45
+ "pytest>=9.0.3",
46
+ "pytest-cov>=7.1.0",
47
+ "python-dotenv>=1.2.2",
48
+ "ruff>=0.15.12",
49
+ "ty>=0.0.34",
50
+ ]
51
+
52
+ [tool.flit.sdist]
53
+ include = ["tests/"]
54
+
55
+ [tool.uv]
56
+ package = true
57
+
58
+ [tool.ruff]
59
+ line-length = 90
60
+
61
+ [tool.pytest.ini_options]
62
+ testpaths = ["tests"]
63
+ pythonpath = ["src"]
64
+
65
+ [tool.ty.src]
66
+ include = ["src/"]
@@ -0,0 +1,10 @@
1
+ """A smart CLI wrapper for docker compose with interactive selection support."""
2
+
3
+ import logging
4
+ from importlib.metadata import version
5
+
6
+ __version__ = version("compose-lazy")
7
+
8
+ logger = logging.getLogger("compose_lazy")
9
+ logger.addHandler(logging.NullHandler())
10
+ logger.propagate = False
@@ -0,0 +1,155 @@
1
+ import logging
2
+ from argparse import ArgumentParser, Namespace
3
+ from typing import Callable, Self
4
+
5
+ from .process import DockerCmdProcessor
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+
10
+ class ArgBuilder:
11
+ def __init__(self, parser: ArgumentParser):
12
+ self.parser = parser
13
+
14
+ def set_defaults(self, func: Callable[[Namespace], int] | None = None) -> Self:
15
+ func = func or DockerCmdProcessor()
16
+ self.parser.set_defaults(func=func)
17
+ return self
18
+
19
+ def add_common_compose_options(self) -> Self:
20
+ return self._add_file_args()._add_profile_args()._add_project_args()
21
+
22
+ def add_service_name_subcmd(self, multiple: bool = False) -> Self:
23
+ """Add positional argument of service name(s) to command definition.
24
+
25
+ multiple=True: accepts multiple service names, all optional (e.g. up, build, stop, etc.).
26
+ multiple=False: accepts single service name, required by docker compose (e.g. exec, run).
27
+ """
28
+ if multiple:
29
+ self.parser.add_argument(
30
+ "service_name",
31
+ nargs="*",
32
+ default=[],
33
+ help="(Optional) target service names",
34
+ )
35
+ # Add trigger option to start interactive selection explicitly.
36
+ self.parser.add_argument(
37
+ "-s",
38
+ "--service",
39
+ action="store_true",
40
+ help="show service name candidates, select interactively",
41
+ )
42
+ else:
43
+ # If no service_name given, interactive selection starts automatically.
44
+ self.parser.add_argument(
45
+ "service_name",
46
+ nargs="?",
47
+ type=lambda x: [x],
48
+ default=[],
49
+ help="(Required) target service name",
50
+ )
51
+ return self
52
+
53
+ def add_inner_bash_cmd_args(self) -> Self:
54
+ self.parser.add_argument(
55
+ "inner_bash_cmd",
56
+ nargs="*",
57
+ default=[],
58
+ help="command to run inside the service (default: bash)",
59
+ )
60
+ return self
61
+
62
+ def add_build_args(self) -> Self:
63
+ self.parser.add_argument(
64
+ "-b",
65
+ "--build",
66
+ action="store_true",
67
+ help="docker compose up `--build`",
68
+ )
69
+ return self
70
+
71
+ def add_detach_args(self) -> Self:
72
+ """add optional argument `-d` to `docker compose up` command."""
73
+ self.parser.add_argument(
74
+ "-d", "--detach", action="store_true", help="docker compose up `-d`"
75
+ )
76
+ return self
77
+
78
+ def add_follow_args(self) -> Self:
79
+ """add optional argument `-f` to `docker compose logs` command."""
80
+ self.parser.add_argument(
81
+ "-fo", "--follow", action="store_true", help="docker compose logs `-f`"
82
+ )
83
+ return self
84
+
85
+ def add_all_args(self) -> Self:
86
+ """add optional argument `--all(-a)` to `docker compose ps` command."""
87
+ self.parser.add_argument(
88
+ "-a",
89
+ "--all",
90
+ action="store_true",
91
+ help="docker compose ps `-a`",
92
+ )
93
+ return self
94
+
95
+ def add_status_args(self) -> Self:
96
+ self.parser.add_argument(
97
+ "-st",
98
+ "--status",
99
+ choices=[
100
+ "created",
101
+ "restarting",
102
+ "running",
103
+ "removing",
104
+ "paused",
105
+ "exited",
106
+ "dead",
107
+ ],
108
+ help="docker compose ps `--status` <STATUS>",
109
+ )
110
+ return self
111
+
112
+ def add_remove_orphans_args(self) -> Self:
113
+ self.parser.add_argument(
114
+ "-ro",
115
+ "--remove-orphans",
116
+ action="store_true",
117
+ help="docker compose down `--remove-orphans`",
118
+ )
119
+ return self
120
+
121
+ def add_wait_args(self) -> Self:
122
+ self.parser.add_argument(
123
+ "-w",
124
+ "--wait",
125
+ action="store_true",
126
+ help="docker compose up `--wait`",
127
+ )
128
+ return self
129
+
130
+ def _add_file_args(self) -> Self:
131
+ self.parser.add_argument(
132
+ "-f",
133
+ "--file",
134
+ nargs="*",
135
+ help="specify compose file(s). if omitted with -f, select interactively",
136
+ )
137
+ return self
138
+
139
+ def _add_project_args(self) -> Self:
140
+ self.parser.add_argument(
141
+ "-p",
142
+ "--project",
143
+ default="",
144
+ help="docker compose `-p PROJECT_NAME`",
145
+ )
146
+ return self
147
+
148
+ def _add_profile_args(self) -> Self:
149
+ self.parser.add_argument(
150
+ "-pf",
151
+ "--profile",
152
+ nargs="*",
153
+ help="specify profile(s). if omitted with -pf, select interactively",
154
+ )
155
+ return self