Skip to content

Commit

Permalink
Solved multiple host values in .ssh/config
Browse files Browse the repository at this point in the history
  • Loading branch information
masasam committed Mar 12, 2018
1 parent 6efa0e6 commit 3f5ae75
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions counsel-tramp.el
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
;;; counsel-tramp.el --- Tramp ivy interface for ssh, docker, vagrant -*- lexical-binding: t; -*-

;; Copyright (C) 2017 by Masashı Mıyaura
;; Copyright (C) 2017-2018 by Masashı Mıyaura

;; Author: Masashı Mıyaura
;; URL: https://github.com/masasam/emacs-counsel-tramp
;; Version: 0.3.1
;; Version: 0.4.1
;; Package-Requires: ((emacs "24.3") (counsel "0.10"))

;; This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -85,12 +85,22 @@ Kill all remote buffers."
(if (string-match "\\`[ \t\n\r]+" host)
(replace-match "" t t host))
(unless (string= host "*")
(push
(concat "/" tramp-default-method ":" host ":")
hosts)
(push
(concat "/ssh:" host "|sudo:root@" host ":/")
hosts))))
(if (string-match "[ ]+" host)
(let ((result (split-string host " ")))
(while result
(push
(concat "/" tramp-default-method ":" (car result) ":")
hosts)
(push
(concat "/ssh:" (car result) "|sudo:root@" (car result) ":/")
hosts)
(pop result)))
(push
(concat "/" tramp-default-method ":" host ":")
hosts)
(push
(concat "/ssh:" host "|sudo:root@" host ":/")
hosts)))))
(when (package-installed-p 'docker-tramp)
(cl-loop for line in (cdr (ignore-errors (apply #'process-lines "docker" (list "ps"))))
for info = (reverse (split-string line "[[:space:]]+" t))
Expand Down

0 comments on commit 3f5ae75

Please sign in to comment.