Skip to content

Commit dd1ddac

Browse files
authored
feat: Replace --options by <SPACE>--<SPACE> (#193)
1 parent ed7f52f commit dd1ddac

File tree

8 files changed

+102
-131
lines changed

8 files changed

+102
-131
lines changed

.makim.yaml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ groups:
7676
sugar ${{ vars.SUGAR_FLAGS }} compose pull --all
7777
sugar ${{ vars.SUGAR_FLAGS }} compose pull
7878
sugar ${{ vars.SUGAR_FLAGS }} compose pull --services service1-1
79-
sugar ${{ vars.SUGAR_FLAGS }} compose-ext start --all --options -d
80-
sugar ${{ vars.SUGAR_FLAGS }} compose-ext restart --all --options -d
81-
sugar ${{ vars.SUGAR_FLAGS }} compose exec --service service1-1 --options -T --cmd env
79+
sugar ${{ vars.SUGAR_FLAGS }} compose-ext start --all -- -d
80+
sugar ${{ vars.SUGAR_FLAGS }} compose-ext restart --all -- -d
81+
sugar ${{ vars.SUGAR_FLAGS }} compose exec --service service1-1 --cmd env -- -T
8282
sugar ${{ vars.SUGAR_FLAGS }} compose stop --all
83-
sugar ${{ vars.SUGAR_FLAGS }} compose run --service service1-1 --options -T --cmd env
83+
sugar ${{ vars.SUGAR_FLAGS }} compose run --service service1-1 --cmd env -- -T
8484
sugar ${{ vars.SUGAR_FLAGS }} compose down
8585
8686
smoke-podman-1:
@@ -98,11 +98,11 @@ groups:
9898
sugar ${{ vars.SUGAR_FLAGS }} podman-ext pull --all
9999
sugar ${{ vars.SUGAR_FLAGS }} podman-ext pull
100100
sugar ${{ vars.SUGAR_FLAGS }} podman-ext pull --services service1-1
101-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext start --all --options -d
101+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext start --all -- -d
102102
sugar ${{ vars.SUGAR_FLAGS }} podman-ext restart --all
103-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext exec --service service1-1 --options -T --cmd env
103+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext exec --service service1-1 --cmd env -- -T
104104
sugar ${{ vars.SUGAR_FLAGS }} podman-ext stop --all
105-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext run --service service1-1 --options -T --cmd env
105+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext run --service service1-1 --cmd env -- -T
106106
sugar ${{ vars.SUGAR_FLAGS }} podman-ext down --all
107107
108108
smoke-2:
@@ -118,7 +118,7 @@ groups:
118118
sugar ${{ vars.SUGAR_FLAGS }} compose build --services service2-1
119119
sugar ${{ vars.SUGAR_FLAGS }} compose pull --all
120120
sugar ${{ vars.SUGAR_FLAGS }} compose stop --all
121-
sugar ${{ vars.SUGAR_FLAGS }} compose run --service service2-1 --options -T --cmd env
121+
sugar ${{ vars.SUGAR_FLAGS }} compose run --service service2-1 --cmd env -- -T
122122
sugar ${{ vars.SUGAR_FLAGS }} compose down
123123
124124
smoke-env-files:
@@ -130,11 +130,11 @@ groups:
130130
SUGAR_FLAGS: --verbose --file tests/containers/.multiple-env.sugar.yaml --profile profile1
131131
run: |
132132
sugar ${{ vars.SUGAR_FLAGS }} compose build
133-
sugar ${{ vars.SUGAR_FLAGS }} compose up --options -d
133+
sugar ${{ vars.SUGAR_FLAGS }} compose up -- -d
134134
135135
for service in service1-1 service1-3; do
136-
sugar ${{ vars.SUGAR_FLAGS }} compose exec --service $service --options -T --cmd env | grep "ENV_VAR_1=value1"
137-
sugar ${{ vars.SUGAR_FLAGS }} compose exec --service $service --options -T --cmd env | grep "ENV_VAR_2=value2"
136+
sugar ${{ vars.SUGAR_FLAGS }} compose exec --service $service --cmd env -- -T | grep "ENV_VAR_1=value1"
137+
sugar ${{ vars.SUGAR_FLAGS }} compose exec --service $service --cmd env -- -T | grep "ENV_VAR_2=value2"
138138
done
139139
140140
sugar ${{ vars.SUGAR_FLAGS }} compose down
@@ -152,7 +152,7 @@ groups:
152152
sugar ${{ vars.SUGAR_FLAGS }} podman-ext build --services service2-1
153153
sugar ${{ vars.SUGAR_FLAGS }} podman-ext pull --all
154154
sugar ${{ vars.SUGAR_FLAGS }} podman-ext stop --all
155-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext run --service service2-1 --options -T --cmd env
155+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext run --service service2-1 --cmd env -- -T
156156
sugar ${{ vars.SUGAR_FLAGS }} podman-ext down
157157
158158
smoke-services:
@@ -185,11 +185,11 @@ groups:
185185
sugar ${{ vars.SUGAR_FLAGS }} compose pull --all
186186
sugar ${{ vars.SUGAR_FLAGS }} compose pull
187187
sugar ${{ vars.SUGAR_FLAGS }} compose pull --services service1-1,service2-1
188-
sugar ${{ vars.SUGAR_FLAGS }} compose-ext start --all --options -d
189-
sugar ${{ vars.SUGAR_FLAGS }} compose-ext restart --all --options -d
190-
sugar ${{ vars.SUGAR_FLAGS }} compose exec --service service2-1 --options -T --cmd env
188+
sugar ${{ vars.SUGAR_FLAGS }} compose-ext start --all -- -d
189+
sugar ${{ vars.SUGAR_FLAGS }} compose-ext restart --all -- -d
190+
sugar ${{ vars.SUGAR_FLAGS }} compose exec --service service2-1 --cmd env -- -T
191191
sugar ${{ vars.SUGAR_FLAGS }} compose stop --all
192-
sugar ${{ vars.SUGAR_FLAGS }} compose run --service service2-1 --options -T --cmd env
192+
sugar ${{ vars.SUGAR_FLAGS }} compose run --service service2-1 --cmd env -- -T
193193
sugar ${{ vars.SUGAR_FLAGS }} compose down
194194
195195
smoke-podman-mix:
@@ -206,11 +206,11 @@ groups:
206206
sugar ${{ vars.SUGAR_FLAGS }} podman-ext pull --all
207207
sugar ${{ vars.SUGAR_FLAGS }} podman-ext pull
208208
sugar ${{ vars.SUGAR_FLAGS }} podman-ext pull --services service1-1,service2-1
209-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext start --all --options -d
209+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext start --all -- -d
210210
sugar ${{ vars.SUGAR_FLAGS }} podman-ext restart --all
211-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext exec --service service2-1 --options -T --cmd env
211+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext exec --service service2-1 --cmd env -- -T
212212
sugar ${{ vars.SUGAR_FLAGS }} podman-ext stop --all
213-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext run --service service2-1 --options -T --cmd env
213+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext run --service service2-1 --cmd env -- -T
214214
sugar ${{ vars.SUGAR_FLAGS }} podman-ext down
215215
216216
smoke-main:
@@ -225,26 +225,26 @@ groups:
225225
sugar ${{ vars.SUGAR_FLAGS }} compose build
226226
sugar ${{ vars.SUGAR_FLAGS }} compose config
227227
sugar ${{ vars.SUGAR_FLAGS }} compose create
228-
sugar ${{ vars.SUGAR_FLAGS }} compose-ext start --options -d
229-
sugar ${{ vars.SUGAR_FLAGS }} compose-ext restart --options -d
230-
sugar ${{ vars.SUGAR_FLAGS }} compose exec --service service1-1 --options -T --cmd env
228+
sugar ${{ vars.SUGAR_FLAGS }} compose-ext start -- -d
229+
sugar ${{ vars.SUGAR_FLAGS }} compose-ext restart -- -d
230+
sugar ${{ vars.SUGAR_FLAGS }} compose exec --service service1-1 --cmd env -- -T
231231
sugar ${{ vars.SUGAR_FLAGS }} compose images
232232
sugar ${{ vars.SUGAR_FLAGS }} compose logs
233233
# port is not complete supported
234234
# sugar --verbose compose port --service service1-1
235235
sugar ${{ vars.SUGAR_FLAGS }} compose ps
236236
sugar ${{ vars.SUGAR_FLAGS }} compose pull
237237
sugar ${{ vars.SUGAR_FLAGS }} compose push
238-
sugar ${{ vars.SUGAR_FLAGS }} compose run --service service1-1 --options -T --cmd env
238+
sugar ${{ vars.SUGAR_FLAGS }} compose run --service service1-1 --cmd env -- -T
239239
sugar ${{ vars.SUGAR_FLAGS }} compose top
240-
sugar ${{ vars.SUGAR_FLAGS }} compose up --options -d
240+
sugar ${{ vars.SUGAR_FLAGS }} compose up -- -d
241241
sugar ${{ vars.SUGAR_FLAGS }} compose version
242242
# port is not complete supported
243243
export SUGAR_PROJECT_NAME="test-`python -c 'from uuid import uuid4; print(uuid4().hex[:7])'`"
244244
echo $SUGAR_PROJECT_NAME
245245
sugar ${{ vars.SUGAR_FLAGS }} compose build
246-
sugar ${{ vars.SUGAR_FLAGS }} compose-ext start --options -d
247-
sugar ${{ vars.SUGAR_FLAGS }} compose-ext restart --options -d
246+
sugar ${{ vars.SUGAR_FLAGS }} compose-ext start -- -d
247+
sugar ${{ vars.SUGAR_FLAGS }} compose-ext restart -- -d
248248
# TODO: it seems that the SUGAR_PROJECT_NAME is not used properly from this block
249249
# docker ps|grep $SUGAR_PROJECT_NAME
250250
sugar ${{ vars.SUGAR_FLAGS }} compose-ext stop
@@ -261,25 +261,25 @@ groups:
261261
sugar ${{ vars.SUGAR_FLAGS }} podman-ext build
262262
sugar ${{ vars.SUGAR_FLAGS }} podman-ext config
263263
# sugar ${{ vars.SUGAR_FLAGS }} podman-ext create
264-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext start --options -d
264+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext start -- -d
265265
sugar ${{ vars.SUGAR_FLAGS }} podman-ext restart
266-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext exec --service service1-1 --options -T --cmd env
266+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext exec --service service1-1 --cmd env -- -T
267267
sugar ${{ vars.SUGAR_FLAGS }} podman-ext images --all
268268
sugar ${{ vars.SUGAR_FLAGS }} podman-ext logs
269269
# port is not complete supported
270270
# sugar --verbose podman-ext port --service service1-1
271271
sugar ${{ vars.SUGAR_FLAGS }} podman-ext ps
272272
sugar ${{ vars.SUGAR_FLAGS }} podman-ext pull
273273
sugar ${{ vars.SUGAR_FLAGS }} podman-ext push
274-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext run --service service1-1 --options -T --cmd env
274+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext run --service service1-1 --cmd env -- -T
275275
# sugar ${{ vars.SUGAR_FLAGS }} podman-ext top
276-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext up --options -d
276+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext up -- -d
277277
sugar ${{ vars.SUGAR_FLAGS }} podman-ext version
278278
# port is not complete supported
279279
export SUGAR_PROJECT_NAME="test-`python -c 'from uuid import uuid4; print(uuid4().hex[:7])'`"
280280
echo $SUGAR_PROJECT_NAME
281281
sugar ${{ vars.SUGAR_FLAGS }} podman-ext build
282-
sugar ${{ vars.SUGAR_FLAGS }} podman-ext start --options -d
282+
sugar ${{ vars.SUGAR_FLAGS }} podman-ext start -- -d
283283
sugar ${{ vars.SUGAR_FLAGS }} podman-ext restart
284284
# TODO: it seems that the SUGAR_PROJECT_NAME is not used properly from this block
285285
# docker ps|grep $SUGAR_PROJECT_NAME
@@ -291,12 +291,12 @@ groups:
291291
pre-run:
292292
- task: docker.killall
293293
run: |
294-
sugar --verbose --profile profile-defaults compose-ext restart --options -d
294+
sugar --verbose --profile profile-defaults compose-ext restart -- -d
295295
sugar --verbose --profile profile1 compose pause
296296
sugar --verbose --profile profile1 compose unpause
297297
sugar --verbose --profile profile1 compose kill
298298
sugar --verbose --profile profile1 compose stop
299-
sugar --verbose --profile profile1 compose rm --options --force
299+
sugar --verbose --profile profile1 compose rm -- --force
300300
sugar --verbose --profile profile1 compose down
301301
302302
smoke-podman-final:
@@ -399,7 +399,7 @@ groups:
399399
smoke-swarm-init:
400400
help: Run smoke tests for swarm commands
401401
run: |
402-
sugar ${{ env.SUGAR_SWARM_FLAGS }} swarm init --options "--advertise-addr 127.0.0.1"
402+
sugar ${{ env.SUGAR_SWARM_FLAGS }} swarm init -- --advertise-addr 127.0.0.1
403403
404404
smoke-swarm-deploy:
405405
help: Run smoke tests for swarm commands
@@ -488,7 +488,7 @@ groups:
488488
help: Kill all running Docker containers
489489
run: |
490490
docker kill $(docker ps -qa) || true
491-
sugar swarm leave --options "--force" || true
491+
sugar swarm leave -- --force || true
492492
493493
podman:
494494
help: Commands for podman

docs/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211

212212
### Features
213213

214-
* Improve the usage of parameters --cmd and --options (formerly --extras) ([#68](https://github.com/osl-incubator/sugar/issues/68)) ([cebdfd8](https://github.com/osl-incubator/sugar/commit/cebdfd808449a14982ca974b24fc36d0fed5eeb7))
214+
* Improve the usage of parameters --cmd and -- (formerly --extras) ([#68](https://github.com/osl-incubator/sugar/issues/68)) ([cebdfd8](https://github.com/osl-incubator/sugar/commit/cebdfd808449a14982ca974b24fc36d0fed5eeb7))
215215

216216
## [1.4.4](https://github.com/osl-incubator/sugar/compare/1.4.3...1.4.4) (2023-04-05)
217217

docs/podman-ext.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ sugar podman-ext build --services app,database
126126
sugar podman-ext start
127127
128128
# Start all services in detached mode
129-
sugar podman-ext start --all --options -d
129+
sugar podman-ext start --all -- -d
130130
131131
# Start specific services in detached mode
132-
sugar podman-ext start --services app,database --options -d
132+
sugar podman-ext start --services app,database -- -d
133133
```
134134

135135
### Executing Commands
@@ -168,7 +168,7 @@ Podman Compose, there are some differences to be aware of:
168168

169169
!!! note Note
170170

171-
1. There is no such flag `-d` present in `--options` for
171+
1. There is no such flag `-d` present in `-- ` for
172172
`sugar podman-ext start`.
173173
2. Experimental commands like `attach`, `cp`, `ls`, `scale`, and `watch` may have
174174
different behavior between Podman versions. These commands are not supported currently in Sugar

docs/swarm.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ profiles:
5252
Initialize a new Docker Swarm on the current engine:
5353
5454
```bash
55-
$ sugar swarm init --options "--advertise-addr 192.168.1.1"
55+
$ sugar swarm init -- --advertise-addr 192.168.1.1
5656
```
5757

5858
### Join a Swarm
5959

6060
Join an existing swarm as a worker or manager node:
6161

6262
```bash
63-
$ sugar swarm join --options "--token SWMTKN-1-... 192.168.1.1:2377"
63+
$ sugar swarm join -- --token SWMTKN-1-... 192.168.1.1:2377
6464
```
6565

6666
## Stack Management
@@ -195,13 +195,13 @@ offers more granular control over individual Docker Swarm services:
195195
Create a new service in the swarm:
196196

197197
```bash
198-
$ sugar swarm service --create --options "--name web nginx"
198+
$ sugar swarm service --create -- --name web nginx
199199
```
200200

201201
Create a service with additional parameters:
202202

203203
```bash
204-
$ sugar swarm service --create --options "--name api --replicas 3 --publish 8080:80 my-api:latest"
204+
$ sugar swarm service --create -- --name api --replicas 3 --publish 8080:80 my-api:latest
205205
```
206206

207207
### Inspect a Service
@@ -229,7 +229,7 @@ $ sugar swarm service --logs web
229229
View logs with additional options:
230230

231231
```bash
232-
$ sugar swarm service --logs web --options "--follow --tail 100"
232+
$ sugar swarm service --logs web -- --follow --tail 100
233233
```
234234

235235
### List Services
@@ -243,7 +243,7 @@ $ sugar swarm service --ls
243243
List services with custom formatting:
244244

245245
```bash
246-
$ sugar swarm service --ls --options "--format 'table {{.Name}}\t{{.Mode}}\t{{.Replicas}}'"
246+
$ sugar swarm service --ls -- --format 'table {{.Name}}\t{{.Mode}}\t{{.Replicas}}'
247247
```
248248

249249
### List Service Tasks
@@ -279,13 +279,13 @@ $ sugar swarm service --scale "web=3,api=5,worker=2"
279279
Update a service configuration:
280280

281281
```bash
282-
$ sugar swarm service --update web --options "--image nginx:alpine"
282+
$ sugar swarm service --update web -- --image nginx:alpine
283283
```
284284

285285
Update with multiple parameters:
286286

287287
```bash
288-
$ sugar swarm service --update api --options "--image my-api:v2 --replicas 5"
288+
$ sugar swarm service --update api -- --image my-api:v2 --replicas 5
289289
```
290290

291291
### Rollback a Service
@@ -364,15 +364,15 @@ $ sugar swarm:node rm node-id
364364
### Update Nodes
365365

366366
```bash
367-
$ sugar swarm:node update node-id --options "--availability drain"
367+
$ sugar swarm:node update node-id -- --availability drain
368368
```
369369

370370
## Command Options
371371

372372
Most swarm commands accept the following common options:
373373

374374
- `--profile`: Specify the profile name to use
375-
- `--options`: Pass additional options to the underlying Docker command
375+
- `-- `: Pass additional options to the underlying Docker command
376376
- `--services`: Specify a comma-separated list of services
377377
- `--all`: Apply the command to all services
378378
- `--stack`: Specify a stack name for stack operations

0 commit comments

Comments
 (0)