ssh2iterm2

command module
v0.10.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2020 License: MIT Imports: 20 Imported by: 0

README

Create iTerm2 dynamic profile from SSH config

Build Status release Go Report Card CLA assistant

Converts your ~/.ssh/config to Dynamic profiles in iTerm2.

$ brew install arnested/ssh2iterm2/ssh2iterm2

By default it looks up your Host definitions in ~/.ssh/config.

You can supply another location via the environment variable SSH2ITERM2_GLOB.

I.e. set SSH2ITERM2_GLOB=~/.ssh/config.d/*.conf to run through all *.conf files in ~/.ssh/config.d and SSH2ITERM2_GLOB=~/.ssh/**/*.conf will run through all *.conf files in all folders under ~/.ssh.

The glob pattern should follow Gos path/filepath patterns.

Config file

Config will be read from ~/Library/Application Support/ssh2iterm2.yaml if the file exists.

The content of the config file could look like:

glob: ~/.ssh/**/*.conf
ssh: /usr/local/bin/ssh

An alternate config file can be read using the --config option or the $SSH2ITERM2_CONFIG_FILE environment variable.

How to run

Just run the binary without any arguments in whatever directory you like.

The generated dynamic profile

The generated dynamic profile has some features/caveats (they suit me well :-)

  • The command calls ssh with an absolute path that is looked up when generating the dynamic profile. That is because iTerm2 doesn't have /usr/local/bin in its path and we would not be able to find a ssh installed by i.e. Homebrew otherwise.

    /usr/local/bin/ssh <host>
    
  • We add the host as a badge

  • If the the filename where the Host is defined is not config we use the filename as a tag on the profile (extension removed from file, preprending digits followed by underscore removed).

    This way you can group your Hosts.

    I.e. all Hosts defined in 20_production.conf will get a "production" tag.

  • A trigger that opens iTerm2s password manager is added on the regular expression \\[sudo\\] password for.

    The password manager will get the host name as parameter.

Download

A compiled MacOS binary can be downloaded from releases.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL