sqitchers / docker-sqitch

Docker Image packaging for Sqitch
MIT License
35 stars 39 forks source link

Adding interactive working and passing commands for windows #47

Closed TroySchmidt closed 1 year ago

TroySchmidt commented 1 year ago

Running sqitch command from Windows wasn't working. I added the interactive entrypoint so that when you only type sqitch you are using it interactively. But if you type additional parameters they are passed on to the container and run as intended. Fully functional now for Windows users.

theory commented 1 year ago

Sqitch has no interactive mode. Confused what this could be fixing.

TroySchmidt commented 1 year ago

The batch file as it stands doesn't work for Windows Docker. -it is interactive mode for Docker. Because it isn't passing the entrypoint for the bash line it doesn't open in interactive mode to the bash command line. The parameters aren't passing into the container because it is trying to do interactive mode. With this fix, if you type in just sqitch it will open in interactive mode as if you were running on the bash line in the container. If you pass parameters, it will forward those properly to run against the container (like an app) and then immediately remove as intended.
So this is both a bugfix (the .bat file as it stands doesn't run in Windows) and a feature enhancement because you can run it two different ways now.

theory commented 1 year ago

Oh I see. With no options, it' supposed to default to the help command:

https://github.com/sqitchers/docker-sqitch/blob/d08d1047f40bf0ba7df5d19d48caed417d6187b9/Dockerfile#L68

Which is how it works for me just running docker run -it --rm sqitch/sqitch on my Mac. It doesn't default to CMD on Windows?

TroySchmidt commented 1 year ago

It does. But it enters some awkward VIM style mode where you have to q to exit out of. It is executing the commands to it properly as it stands now. This just improves it so that when someone types in just the sqitch.bat command it will open them into interactive mode.
If the enhancement to run interactively isn't wanted then I can find a way to make it execute without locking you into the awkward mode you have to q to exit.

theory commented 1 year ago

Oh, that's intended. The help and documentation interfaces use a pager. Might make sense to disable it for the default command, though, by adding --no-pager to the CMD array. Does that fix the issue for you?