Issue with nested op command and zsh
Hey Danny,
Still loving your tool and I have recently setup new machine with the latest version.
I have this op.conf in my project
docker-comp: docker compose -f ./docker-compose.yml
docker-exec: op docker-comp exec web
up-s: op docker-comp up web -d
up: docker compose -f ./docker-compose.yml up web -d
down: docker compose -f ./docker-compose.yml down --remove-orphans
down-s: op docker-comp down --remove-orphans
composer: docker compose exec web composer about
comp: op composer
about: op composer about
php: op docker-exec php
The issue is when I use any of the commands with the nested op docker-comp. I get this result below suggesting the syntax of the docker compose is not correct.
❯ op down-s
Usage: docker compose [OPTIONS] COMMAND
Define and run multi-container applications with Docker
if I use the full command down: docker compose -f ./docker-compose.yml down --remove-orphans it works fine
I have zsh and oh-my-zsh but it is also doing the same thing in bash as well.
I thought I should test some other nested commands and the about: command works with the nested op composer about.
Do you have any suggestions?
I have taken the format of these commands from my previous PC which is using opcode 0.6.5 and I never had problems there.
Really appreciate any and all support. thanks
Let me check.
Just a note in the meantime. There is no need to create "partial command shortcuts":
composer: docker compose exec web composer about
comp: op composer # <== this is redundant. "op comp" will work without it
opcode will find the first matching command, if it is not an exact match.
Found the problem.
Since version 1.1.0, you can use multiline commands, and as a result - I had to remove the automatic addition of "$@" to your commands.
The relevant pull request is #35
Which means that you just need to add "$@" (or "$1", "$2" etc if applicable) to your commands, wherever you want args to be propagated.
docker-comp: docker compose -f ./docker-compose.yml "$@"
As another side note, why are you providing "-f ./docker-compose.yml" - isn't it the default?
See also:
Oh ya I read that in the updates and now you mention it, it makes so much sense. Thanks Danny, love your work.
You're welcome Robert, and thanks for your sponsorship. It also took me a minute to recall that specific change.
Please do not hesitate to open an issue/discussion if something isn't clear or working as expected (here or in my other repos you use).