Skip to content

Commit 8731643

Browse files
author
Matt Turner
committed
Merge pull request #140 from thshdw/fix-editor-settings
Feature add open_in and default_theme. Fix editor settings
2 parents da68154 + addb62a commit 8731643

File tree

5 files changed

+313
-137
lines changed

5 files changed

+313
-137
lines changed

README.md

Lines changed: 155 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,190 @@ A simple SSH shortcut menu for OS X
66

77
![How Shuttle works](https://raw.github.com/fitztrev/shuttle/gh-pages/img/how-shuttle-works.gif)
88

9-
***Sidenote***: *Many people ask, so here's how I have [my terminal setup](https://github.com/fitztrev/shuttle/wiki/My-Terminal-Prompt).*
9+
**Sidenote**: *Many people ask, so here's how I have [my terminal setup](https://github.com/fitztrev/shuttle/wiki/My-Terminal-Prompt).*
1010

1111
## Installation
1212

1313
1. Download [Shuttle](http://fitztrev.github.io/shuttle/)
1414
2. Copy to Applications
1515

16-
## Customization
16+
## JSON Path Change
1717

18-
The default, out-of-the-box configuration should be good enough to get started. However, if you're looking to customize the appearance further, here are a few advanced tips.
18+
In your home directory create a file called ```~/.shuttle.path```
19+
In this file should be a single line with the path to the JSON settings file.
1920

20-
### Disabling `~/.ssh/config` hosts
21+
```
22+
/Users/thshdw/Dropbox/shuttle/shuttle.json
23+
```
24+
shuttle will read ```~/.shuttle.path``` first and use its contents as the path to your JSON file.
25+
26+
## JSON Options
27+
### Global settings
28+
#### ```"editor": "VALUE",```
29+
_This changes the app that opens settings.json for editing (Global Setting)_
30+
31+
Possible values are ```default```, ```nano```, ```vi```, ```vim``` or any terminal based editor.
32+
```default``` opens settings.json in whatever app is registered as the default for extension ```.json```
33+
```
34+
"editor": "vim",
35+
```
36+
would open ```~/.shuttle.json``` in vim
37+
38+
----
39+
40+
#### ```"launch_at_login": VALUE,```
41+
_This allows you to flag the shuttle.app to start automatically (Global Setting)_
42+
43+
Possible values are ```true``` or ```false```
44+
45+
----
46+
47+
#### ```"terminal": "VALUE",```
48+
_This allows you to set the default terminal (Global Setting)_
49+
50+
Possible values are ```Terminal.app``` or ```iTerm```
51+
52+
----
53+
54+
#### ```"iTerm_version": "VALUE",```
55+
_This changes the applescripts for iTerm (Global Setting)_
56+
57+
Possible values are ```stable``` or ```nightly```
58+
59+
**If ```terminal``` is set to ```iTerm``` this setting is mandatory**
60+
61+
_This setting is ignored if your terminal is set to ```Terminal.app```_
62+
63+
----
64+
65+
#### ```"default_theme": "Homebrew",```
66+
_This sets the Terminal theme for all windows. (Global Setting)_
67+
68+
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.
69+
70+
In iTerm the profile names are case sensitive.
71+
72+
**Please ensure the theme names you set are valid. If shuttle passes theme "Dagobah" and it does not exist in iTerm or OS X Terminal then your command won't run. This is because the applescripts are not making any checks to see if the theme you passed actually exists within the terminal application.**
73+
74+
This setting can be overwritten by the command level ```"theme"``` settings
75+
76+
----
77+
78+
#### ```"open_in": "VALUE",```
79+
_This changes the default action for how commands are opened (Global Setting)_
80+
81+
Possible values are ```tab``` or ```new```.
82+
83+
```tab``` opens the command in the active terminal in a new tab.
84+
85+
```new``` opens the command in a new window.
86+
87+
This setting can be overwritten by the command level ```"inTerminal"``` settings
88+
89+
----
90+
91+
#### ```"show_ssh_config_hosts": VALUE,```
92+
_This changes parsing ssh config. By default, Shuttle will parse your ```~/.ssh/config``` file for hosts. (Global Setting)_
93+
94+
Possible values are ```false``` or ```true```
95+
96+
----
2197

22-
By default, Shuttle will parse your `~/.ssh/config` file for hosts.
98+
#### ```"ssh_config_ignore_hosts": ["VALUE", "VALUE"],```
99+
_This will ignore hosts in the ssh config. (Global Setting)_
23100

24-
##### To disable all ~/.ssh/config entries:
101+
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:
102+
103+
```"ssh_config_ignore_hosts": ["github.com", "git.example.com"],```
104+
105+
----
106+
107+
#### ```"ssh_config_ignore_keywords": ["VALUE"],```
108+
_This will ignore keywords in your ssh config. (Global Setting)_
109+
110+
Possible values are the keywords in your ssh config that you want to ignore.
111+
112+
----
113+
114+
**Additional ssh config customization**
115+
#### Nested menus for `~/.ssh/config` hosts
116+
117+
##### Create a menu item at "work" > "servers" > "web01"
25118

26119
```
27-
"show_ssh_config_hosts": false,
120+
Host work/servers/web01
121+
28122
```
29-
30-
#### Disable specific hosts:
123+
\- *or* -
31124

32125
```
33-
"ssh_config_ignore_hosts": ["github.com", "git.example.com"],
126+
Host gandalf
127+
# shuttle.name = work/servers/web01 (webserver)
128+
34129
```
35130

36-
#### Disable hosts that contain a keyword:
131+
### Command level settings
132+
_Command level settings are unique to your command and will overwrite the Global setting equivalent_
133+
134+
#### ```"cmd": "VALUE"```
135+
_This is the command / script that will be launched in the terminal. (Command setting)_
37136

137+
Where Value is a command or script.
38138
```
39-
"ssh_config_ignore_keywords": ["git"],
139+
"cmd": "ps aux | grep [s]sh"
40140
```
141+
Would check for ssh processes.
41142

42-
### Nested menus for `~/.ssh/config` hosts
143+
----
43144

44-
#### Create a menu item at "work" > "servers" > "web01"
145+
#### ```"name": "VALUE"```
146+
_This sets the text that will appear in shuttles drop down menu. (Command setting)_
45147

148+
Were Value is the text you want to see in the drop down menu for this command.
46149
```
47-
Host work/servers/web01
48-
150+
"name": "SSH to my wordpress blog"
49151
```
50-
\- *or* -
152+
153+
This value can also set the title of the terminal window if ```"title" :"VALUE"``` is not set.
154+
155+
----
156+
157+
#### ```"inTerminal": "VALUE",```
158+
_This sets how command will open in the terminal window. (Command setting)_
159+
160+
Possible values are ```new```, ```tab```, or ```current```
161+
162+
```new``` opens the command in a new terminal window.
163+
164+
```tab``` opens the command in the active terminal window in a new tab.
165+
166+
```current``` opens the command in the active terminal's window.
167+
168+
When using using ```current``` I recommend that you wrap the command in some user input like this:
51169

52170
```
53-
Host gandalf
54-
# shuttle.name = work/servers/web01 (webserver)
55-
171+
echo "are you sure y/n"; read sure; if [ "$sure" == "y" ]; then echo "running command" && ps aux | grep [s]sh; else echo "exiting..."; fi
56172
```
57173

174+
Do this as a precaution as it could be possible to run a command on the wrong host.
175+
176+
----
177+
178+
#### ```"theme": "VALUE",```
179+
_This sets the theme for the terminal window. (Command setting)_
180+
181+
Possible values are the profile names for iTerm or OS X Terminal.
182+
183+
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.
184+
185+
----
186+
187+
#### ```"title": "VALUE"```
188+
_This sets the text that will appear in the terminal's title bar. (Command setting)_
189+
190+
Where VALUE is the text you want to set in the terminals title bar.
191+
192+
If ```title``` is missing shuttle uses the menu's name and sets this as ```title```
58193

59194
## Roadmap
60195

Shuttle/AppDelegate.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,21 @@
1515

1616
NSStatusItem *statusItem;
1717
NSString *shuttleConfigFile;
18-
NSString *shuttleJSONPath;
1918

2019
// This is for the JSON File
2120
NSDate *configModified;
2221
NSDate *sshConfigUser;
2322
NSDate *sshConfigSystem;
2423

25-
NSString *terminalPref;
26-
NSString *editorPref;
27-
NSString *iTermVersion;
24+
//Global settings Pref in the JSON file.
25+
NSString *shuttleJSONPathPref; //alternate path the JSON file
26+
NSString *terminalPref; //which terminal will we be using iTerm or Terminal.app
27+
NSString *editorPref; //what app opens the JSON fiile vi, nano...
28+
NSString *iTermVersionPref; //which version of iTerm nightly or stable
29+
NSString *openInPref; //by default are commands opened in tabs or new windows.
30+
NSString *themePref; //The global theme.
31+
32+
//used to gather ssh config settings
2833
NSMutableArray* shuttleHosts;
2934
NSMutableArray* ignoreHosts;
3035
NSMutableArray* ignoreKeywords;

0 commit comments

Comments
 (0)