Skip to content
royaso edited this page Jun 12, 2019 · 4 revisions

To make page creation easier you will only make one page and all content will be translated in that page. This is an example page that shows translators how to format the wiki in another language.

Shuttle - A simple SSH shortcut menu for macOS

#Documentation ##什么是shuttle? Shuttle is an app which mainly launches terminal based commands. Commands live in the shuttle.json file.

Shuttle was created by Trevor Fitzgerald and inspired by SSHMenu, the GNOME applet for Linux.

##What can I do with it? You can...

  • Build a menu of your favorite ssh servers.
  • Use it to store your web browser bookmarks.
  • Keep a list of your file servers.
  • Launch commands in existing terminal windows.

Shuttle is very customizable. Each window can have its own theme and title. See the help section for more info.

Installation

  1. Download Shuttle
  2. Copy to Applications

JSON Path Change

In your home directory create a file called ~/.shuttle.path In this file should be a single line with the path to the JSON settings file.

##Global Settings Global settings can be overwritten by command level settings. Use Global settings to change things for all commands, like themes and how windows open.

"editor": "VALUE",

This changes the app that opens settings.json for editing (Global Setting)

Possible values are default, nano, vi, vim or any terminal based editor. default opens settings.json in whatever app is registered as the default for extension .json

"editor": "vim",

would open ~/.shuttle.json in vim


"launch_at_login": VALUE,

This allows you to flag the shuttle.app to start automatically (Global Setting)

Possible values are true or false


"terminal": "VALUE",

This allows you to set the default terminal (Global Setting)

Possible values are Terminal.app or iTerm


"iTerm_version": "VALUE",

This changes the applescripts for iTerm (Global Setting)

Possible values are legacy or stable or nightly

If terminal is set to iTerm this setting is mandatory

"iTerm_version": "legacy", targeting iTerm 2.14

"iTerm_version": "stable", targeting new versions of iTerm

"iTerm_version": "nightly",targeting only the nightly build of iTerm

This setting is ignored if your terminal is set to Terminal.app


"default_theme": "Homebrew",

This sets the Terminal theme for all windows. (Global Setting)

Possible values are the Profile names in your terminal preferences. iTerm ships with one Profile named "Default". OS X Terminal ships with several. To see the names see the preferences area of the terminal you are using.

In iTerm the profile names are case sensitive.

Please ensure the theme names you set are valid. If shuttle passes theme "Dagobah" and it does not exist in iTerm, shuttle's applescripts fall back to the default profile. In iTerm this profile is called Default. If you have removed Default or renamed it shuttle may not open your command.

This setting can be overwritten by the command level "theme" settings


"open_in": "VALUE",

This changes the default action for how commands are opened (Global Setting)

Possible values are tab or new.

tab opens the command in the active terminal in a new tab.

new opens the command in a new window.

This setting can be overwritten by the command level "inTerminal" settings


"show_ssh_config_hosts": VALUE,

This changes parsing ssh config. By default, Shuttle will parse your ~/.ssh/config file for hosts. (Global Setting)

Possible values are false or true


"ssh_config_ignore_hosts": ["VALUE", "VALUE"],

This will ignore hosts in the ssh config. (Global Setting)

Possible values are the hosts in your config that you want to ignore. If you had github.com and git.example.com in your ssh config, to ignore them you set:

"ssh_config_ignore_hosts": ["github.com", "git.example.com"],


"ssh_config_ignore_keywords": ["VALUE"],

This will ignore keywords in your ssh config. (Global Setting)

Possible values are the keywords in your ssh config that you want to ignore.

##Command Settings Command level settings are unique to your command and will overwrite the Global setting equivalent

"cmd": "VALUE"

This is the command / script that will be launched in the terminal. (Command setting)

Where Value is a command or script.

"cmd": "ps aux | grep [s]sh"

Would check for ssh processes.


"name": "VALUE"

This sets the text that will appear in shuttles drop down menu. (Command setting)

Were Value is the text you want to see in the drop down menu for this command.

"name": "SSH to my wordpress blog"

This value can also set the title of the terminal window if "title" :"VALUE" is not set.


"inTerminal": "VALUE",

This sets how command will open in the terminal window. (Command setting)

Possible values are new, tab, or current

new opens the command in a new terminal window.

tab opens the command in the active terminal window in a new tab.

current opens the command in the active terminal's window.

When using using current I recommend that you wrap the command in some user input like this:

echo "are you sure y/n"; read sure; if [ "$sure" == "y" ]; then echo "running command" && ps aux | grep [s]sh; else echo "exiting..."; fi

Do this as a precaution as it could be possible to run a command on the wrong host.


"theme": "VALUE",

This sets the theme for the terminal window. (Command setting)

Possible values are the profile names for iTerm or OS X Terminal.

If "theme" is not set and "default_theme" is not set then shuttle passes Profile Default for iTerm and Profile basic for OS X terminal.


"title": "VALUE"

This sets the text that will appear in the terminal's title bar. (Command setting)

Where VALUE is the text you want to set in the terminals title bar.

If title is missing shuttle uses the menu's name and sets this as title

##SSH Config File Settings Additional ssh config customization

Nested menus for ~/.ssh/config hosts

Create a menu item at "work" > "servers" > "web01"
Host work/servers/web01
        HostName [email protected]

- or -

Host gandalf
        # shuttle.name = work/servers/web01 (webserver)
        HostName [email protected]

#Resources

fitztrev's Terminal Configuration

Many people ask me how I have my terminal setup to get the colors and such.

I use iTerm2 (with Solarized theme), zsh, and Oh My Zsh (with the agnoster theme). I keep all my dotfiles and such here if you'd like to see.

Run commands directly from command line

@hendricius has created a terminal version of the shuttle client. shuttle_cli uses the same .shuttle.json configuration file.

$ shuttle
+--------+---------------------------------------------------------------------+
| number | name                 | command                                       |
+--------+----------------------+-----------------------------------------------+
| 1      | Zeit.io              | ssh [email protected]                               |
| 2      | Client X             | ssh [email protected]                               |
| 3      | Trapserver           | ssh [email protected]                             |
+--------+----------------------+-----------------------------------------------+

Enter a bookmark number to connect:
$ 3

connecting....

Installation

You will need Ruby 2 installed on your mac. If you don't have it, have a look at rbenv and ruby-build

Install it yourself as:

$ gem install shuttle_cli

Make sure to rehash your environment:

$ rbenv rehash

The source of the gem can be found at: https://github.com/hendricius/shuttle-cli