Skip to content

add popup docker-containers-term-popup #32

Description

@roymath-zz

Hi - I don't see an obvious way to create a term buffer instead of a shell buffer.. so I wrote the below. Let me know if there is a better way, or if you would like me to submit a PR.

(require 'docker-containers)

(docker-utils-define-popup docker-containers-term-popup
  "Popup for doing M-x `term' to containers."
  'docker-containers-popups
  :actions  '((?a "Term" docker-containers-term-selection)))

(define-key docker-containers-mode-map "a" 'docker-containers-term-popup)

(defun docker-containers-term-selection ()
  "Run `docker-container-term' on the containers selection."
  (interactive)
  (--each (docker-utils-get-marked-items-ids)
    (docker-container-term it)))

(defun docker-container-term (container)
  (interactive (list (docker-read-container-name "container: ")))
  (let ((name (format "*term (docker/%s)*" container)))
	(term "/bin/bash")
	(rename-buffer name)
	(insert (format "docker exec -it %s bash" container))
	(term-send-input)))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions