Alfred SSH Plugin 개발
by Qerogram서론
tmux 없이, 터미널을 다수 띄워놓고 작업할 때 서버키는 것과 로그인 절차가 귀찮아서 Alfred를 통해 Shortcut으로 지정할 수 있게 플러그인을 작성했다. 본 코드는 Catalina 10.15.4버전에서 작성되었고, Alfred 4.0.9 버전에서 테스팅했다. iterm2를 사용 중이면, 아래의 스크립트를 적용하면 환경을 유지할 수 있다. Alfred -> Features -> Terminal 메뉴에서 Application을 Custom으로 만든 뒤 아래의 코드를 입력하면 iTerm2 Environment 그대로 가져갈 수 있다. 복사가 안될까봐 미리 파일로 첨부한다.
on alfred_script(q)
if application "iTerm2" is running or application "iTerm" is running then
run script "
on run {q}
tell application \"iTerm\"
activate
try
select first window
set onlywindow to true
on error
create window with default profile
select first window
set onlywindow to true
end try
tell the first window
if onlywindow is false then
create tab with default profile
end if
tell current session to write text q
end tell
end tell
end run
" with parameters {q}
else
run script "
on run {q}
tell application \"iTerm\"
activate
try
select first window
on error
create window with default profile
select first window
end try
tell the first window
tell current session to write text q
end tell
end tell
end run
" with parameters {q}
end if
end alfred_script
사용법은 간단하다. 이해가 안된다면 아래의 깃허브를 보면 된다.
qerogram/Alfred_SSH_Connection_Plugin
Alfred SSH Connection Plugin for OS X. Contribute to qerogram/Alfred_SSH_Connection_Plugin development by creating an account on GitHub.
github.com
사용방법
1. WorkFlow 등록.
2. 핫키 설정 및 Terminal Command에서 인자 설정
3. WorkFlow 우 클릭 -> Open in Finder -> ALFRED_SSH_PLUGIN.py를 수정해준다.
(아이피, 포트, 아이디, 비번 등)
[+] Automation VMWare Local Booting 기능도 구현해진 상태다. 2번에서 Terminal Command를 설정할 때, 3번째 인자로 VMWare에 등록된 이미지 명을 적어주면 된다. (ex, Docker.vmx라면 Docker)
결과적으로 아래와 같이 잘 동작하는 것을 확인할 수 있다.
'잡다한 것' 카테고리의 다른 글
Logstash grok test용 conf 파일 (0) | 2021.03.31 |
---|---|
KIBANA 설치 (0) | 2021.03.25 |
mnist dataset 로드할 때, 503 error 해결방법 (0) | 2021.03.18 |
Let's compile Python Source Code into DLL using Python Embedding (0) | 2020.06.03 |
쉘 스크립트로 mysql 쉽게 접속하기 (0) | 2018.01.31 |
블로그의 정보
Data+
Qerogram