Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Allow to be able to choose custom Docker path. #19

Open
CleoMenezesJr opened this issue Sep 11, 2022 · 2 comments
Open
Labels
good first issue Good for newcomers

Comments

@CleoMenezesJr
Copy link

For those who work with sandbox apps, it is common to create symlinks for other Docker paths, or even use the Podman instead of the Docker. It would be nice to be able to have an option for this. Nowadays, I modify this manually, but in each update it will end up breaking.

function M.attachToContainer()
	local containers = {}
~	local foundContainers = fn.systemlist("~/.local/bin/docker container ls -a --format '{{.Names}} {{.Image}}'")
	if fn.len(foundContainers) == 0 then
		buildFromImage()
		return
	end
	for i, container in pairs(foundContainers) do
		print(string.format("%d. %s", i, container))
		local name = vim.split(container, "%s")
		table.insert(containers, { image = name[2], name = name[1] })
	end
	local selected = tonumber(fn.input("Select container number: "))
	if not selected then
		return
	end
	local containerName = containers[selected]
~	local containerIsRunning = fn.system("~/.local/bin/docker container ps --format '{{.Names}}'"):find(containerName.name)
	if not containerIsRunning then
~		local containerIsCreated = fn.system("~/.local/bin/docker container ps -a --format '{{.Names}}'"):find(containerName.name)
		if not containerIsCreated then
			runContainer(containerName)
		else
			startContainer(containerName)
		end
	end
end
@jamestthompson3
Copy link
Owner

Great idea! This would be an excellent feature for a first contribution to the codebase :)

@jamestthompson3 jamestthompson3 added the good first issue Good for newcomers label Sep 11, 2022
@CleoMenezesJr
Copy link
Author

Unfortunately, I don't have enough knowledge to contribute plugins to Neovim. Certainly this here would not be an issue, but a PR. lmao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants