Skip to content
Snippets Groups Projects
Commit eab86ef8 authored by George Nachman's avatar George Nachman
Browse files

Merge branch 'master' of https://github.com/gnachman/iTerm2

parents 8cc9d096 4ae74bbd
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -9,7 +9,6 @@
iTerm2.xcodeproj/project.xcworkspace
build/
.DS_Store
iTerm.xcodeproj/*
canary.xml
testing.xml
testing_changes.html
Loading
Loading
@@ -18,8 +17,7 @@ DerivedData/
Intermediates/
NMSSH.framework.dSYM/
NMSSH/
iTerm2.xcodeproj/xcuserdata/
iTerm2.xcodeproj/xcuserdata/*
ColorPicker/ColorPicker.xcodeproj/project.xcworkspace/xcuserdata/
ColorPicker/ColorPicker.xcodeproj/xcuserdata/
iTerm2.xcodeproj/project.xcworkspace/contents.xcworkspacedata
2.3.0
before_install: ./ci/before_install.sh
bundler_args: --without documentation --without development --deployment --jobs=3 --retry=3
osx_image: xcode8.2
osx_image: xcode8.3
language: objective-c
script: ./ci/script.sh
after_success: ./ci/after_success.sh
Loading
Loading
GIT
remote: https://github.com/venmo/slather
revision: 7a0921b2470b32839e1e2085305d7088b977f6c1
revision: d2a98a7641b49588eba420bd889f91522f7f5732
branch: master
specs:
slather (1.8.3)
slather (2.4.1)
CFPropertyList (~> 2.2)
activesupport (>= 4.0.2, < 5)
clamp (~> 0.6)
nokogiri (~> 1.6.3)
xcodeproj (~> 0.28.2)
nokogiri (~> 1.6)
xcodeproj (~> 1.4)
 
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.5)
CFPropertyList (2.3.5)
activesupport (4.2.8)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
claide (0.9.1)
claide (1.0.1)
clamp (0.6.5)
cocoapods (0.39.0)
activesupport (>= 4.0.2)
claide (~> 0.9.1)
cocoapods-core (= 0.39.0)
cocoapods-downloader (~> 0.9.3)
cocoapods-plugins (~> 0.4.2)
cocoapods-search (~> 0.1.0)
cocoapods-stats (~> 0.6.2)
cocoapods-trunk (~> 0.6.4)
cocoapods-try (~> 0.5.1)
cocoapods (1.2.0)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.1, < 2.0)
cocoapods-core (= 1.2.0)
cocoapods-deintegrate (>= 1.0.1, < 2.0)
cocoapods-downloader (>= 1.1.3, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.1.2, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored (~> 1.2)
escape (~> 0.0.4)
molinillo (~> 0.4.0)
fourflusher (~> 2.0.1)
gh_inspector (~> 1.0)
molinillo (~> 0.5.5)
nap (~> 1.0)
xcodeproj (~> 0.28.2)
cocoapods-core (0.39.0)
activesupport (>= 4.0.2)
ruby-macho (~> 0.2.5)
xcodeproj (>= 1.4.1, < 2.0)
cocoapods-core (1.2.0)
activesupport (>= 4.0.2, < 5)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-downloader (0.9.3)
cocoapods-plugins (0.4.2)
cocoapods-deintegrate (1.0.1)
cocoapods-downloader (1.1.3)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (0.1.0)
cocoapods-stats (0.6.2)
cocoapods-trunk (0.6.4)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.1.2)
nap (>= 0.8, < 2.0)
netrc (= 0.7.8)
cocoapods-try (0.5.1)
cocoapods-try (1.1.0)
colored (1.2)
colored2 (3.1.2)
escape (0.0.4)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
i18n (0.7.0)
json (1.8.3)
mini_portile2 (2.0.0)
minitest (5.8.3)
molinillo (0.4.1)
nap (1.0.0)
gh_inspector (1.0.3)
i18n (0.8.1)
mini_portile2 (2.1.0)
minitest (5.10.1)
molinillo (0.5.7)
nanaimo (0.2.3)
nap (1.1.0)
netrc (0.7.8)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
rouge (1.10.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
nokogiri (1.7.1)
mini_portile2 (~> 2.1.0)
rouge (1.11.1)
ruby-macho (0.2.6)
thread_safe (0.3.6)
tzinfo (1.2.3)
thread_safe (~> 0.1)
xcodeproj (0.28.2)
activesupport (>= 3)
claide (~> 0.9.1)
colored (~> 1.2)
xcpretty (0.2.2)
xcodeproj (1.4.4)
CFPropertyList (~> 2.3.3)
claide (>= 1.0.1, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.3)
xcpretty (0.2.6)
rouge (~> 1.8)
xcpretty-travis-formatter (0.0.4)
xcpretty (~> 0.2, >= 0.0.7)
Loading
Loading
@@ -82,4 +94,4 @@ DEPENDENCIES
xcpretty-travis-formatter
 
BUNDLED WITH
1.11.2
1.14.6
Loading
Loading
@@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBInt32Array with a copy of the values.
**/
- (instancetype)initWithValues:(const int32_t [])values
- (instancetype)initWithValues:(const int32_t [_Nullable])values
count:(NSUInteger)count;
 
/**
Loading
Loading
@@ -161,7 +161,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const int32_t [])values count:(NSUInteger)count;
- (void)addValues:(const int32_t [_Nullable])values count:(NSUInteger)count;
 
/**
* Adds the values from the given array to this array.
Loading
Loading
@@ -268,7 +268,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBUInt32Array with a copy of the values.
**/
- (instancetype)initWithValues:(const uint32_t [])values
- (instancetype)initWithValues:(const uint32_t [_Nullable])values
count:(NSUInteger)count;
 
/**
Loading
Loading
@@ -333,7 +333,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const uint32_t [])values count:(NSUInteger)count;
- (void)addValues:(const uint32_t [_Nullable])values count:(NSUInteger)count;
 
/**
* Adds the values from the given array to this array.
Loading
Loading
@@ -440,7 +440,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBInt64Array with a copy of the values.
**/
- (instancetype)initWithValues:(const int64_t [])values
- (instancetype)initWithValues:(const int64_t [_Nullable])values
count:(NSUInteger)count;
 
/**
Loading
Loading
@@ -505,7 +505,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const int64_t [])values count:(NSUInteger)count;
- (void)addValues:(const int64_t [_Nullable])values count:(NSUInteger)count;
 
/**
* Adds the values from the given array to this array.
Loading
Loading
@@ -612,7 +612,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBUInt64Array with a copy of the values.
**/
- (instancetype)initWithValues:(const uint64_t [])values
- (instancetype)initWithValues:(const uint64_t [_Nullable])values
count:(NSUInteger)count;
 
/**
Loading
Loading
@@ -677,7 +677,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const uint64_t [])values count:(NSUInteger)count;
- (void)addValues:(const uint64_t [_Nullable])values count:(NSUInteger)count;
 
/**
* Adds the values from the given array to this array.
Loading
Loading
@@ -784,7 +784,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBFloatArray with a copy of the values.
**/
- (instancetype)initWithValues:(const float [])values
- (instancetype)initWithValues:(const float [_Nullable])values
count:(NSUInteger)count;
 
/**
Loading
Loading
@@ -849,7 +849,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const float [])values count:(NSUInteger)count;
- (void)addValues:(const float [_Nullable])values count:(NSUInteger)count;
 
/**
* Adds the values from the given array to this array.
Loading
Loading
@@ -956,7 +956,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBDoubleArray with a copy of the values.
**/
- (instancetype)initWithValues:(const double [])values
- (instancetype)initWithValues:(const double [_Nullable])values
count:(NSUInteger)count;
 
/**
Loading
Loading
@@ -1021,7 +1021,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const double [])values count:(NSUInteger)count;
- (void)addValues:(const double [_Nullable])values count:(NSUInteger)count;
 
/**
* Adds the values from the given array to this array.
Loading
Loading
@@ -1128,7 +1128,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBBoolArray with a copy of the values.
**/
- (instancetype)initWithValues:(const BOOL [])values
- (instancetype)initWithValues:(const BOOL [_Nullable])values
count:(NSUInteger)count;
 
/**
Loading
Loading
@@ -1193,7 +1193,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const BOOL [])values count:(NSUInteger)count;
- (void)addValues:(const BOOL [_Nullable])values count:(NSUInteger)count;
 
/**
* Adds the values from the given array to this array.
Loading
Loading
@@ -1325,7 +1325,7 @@ NS_ASSUME_NONNULL_BEGIN
* @return A newly initialized GPBEnumArray with a copy of the values.
**/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
rawValues:(const int32_t [_Nullable])values
count:(NSUInteger)count;
 
/**
Loading
Loading
@@ -1435,7 +1435,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const int32_t [])values count:(NSUInteger)count;
- (void)addValues:(const int32_t [_Nullable])values count:(NSUInteger)count;
 
 
/**
Loading
Loading
@@ -1486,7 +1486,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values Array containing the raw enum values to add to this array.
* @param count The number of raw values to add.
**/
- (void)addRawValues:(const int32_t [])values count:(NSUInteger)count;
- (void)addRawValues:(const int32_t [_Nullable])values count:(NSUInteger)count;
 
/**
* Inserts a raw enum value at the given index.
Loading
Loading
This diff is collapsed.
# iTerm2 API
This is an example of how to use the iTerm2 API in Python. It sets up a
websocket connection, sends an RPC to subscribe to notifications about changes
to the current username, hostname, or working directory. It prints incoming
Loading
Loading
@@ -7,17 +9,25 @@ notifications.
 
First, install the dependencies.
 
### Using virtualenvwrapper
```
mkvirtualenv iterm2api
pip install websocket-client
pip install protobuf
```
### Using system python
It is also possible to install the dependencies as system libraries.
```
sudo /usr/bin/python -m pip install websocket-client
sudo /usr/bin/python -m pip install protobuf
```
 
Then `cd api/examples/python` and then `./iterm2.py` to run the program.
 
This silly way of running pip is needed if you have more than one version of
python installed.
Now you can run `iTerm2/api/examples/python`.
 
## Writing your own app
Loading
Loading
#!/usr/bin/python
# This is python 2.7 on macOS 10.12.
 
from __future__ import print_function
import api_pb2
import sys
import thread
Loading
Loading
@@ -11,7 +13,7 @@ callbacks = []
 
def list_sessions(ws, argv):
def callback(response):
print str(response)
print(str(response))
ws.close()
request = api_pb2.Request()
request.list_sessions_request.SetInParent()
Loading
Loading
@@ -19,15 +21,15 @@ def list_sessions(ws, argv):
 
def send_text(ws, argv):
def callback(response):
print str(response)
print(str(response))
ws.close()
request = api_pb2.Request()
request.send_text_request.text = argv[2]
SendRPC(ws, request, callback)
 
def handle_location_change_notification(location_change_notification):
print "Location changed"
print str(location_change_notification)
print("Location changed")
print(str(location_change_notification))
 
def SendRPC(ws, message, callback):
ws.send(message.SerializeToString(), opcode=websocket.ABNF.OPCODE_BINARY)
Loading
Loading
@@ -39,14 +41,14 @@ def handle_notification(notification):
 
def handle_notification_response(response):
if not response.HasField('notification_response'):
print "Malformed notification response"
print str(response)
print("Malformed notification response")
print(str(response))
return
if response.notification_response.status != api_pb2.NotificationResponse.OK:
print "Bad status in notification response"
print str(response)
print("Bad status in notification response")
print(str(response))
return
print "Notifcation response ok"
print("Notifcation response ok")
 
def on_message(ws, message):
response = api_pb2.Response()
Loading
Loading
@@ -60,19 +62,19 @@ def on_message(ws, message):
callback(response)
 
def on_error(ws, error):
print "Error: " + str(error)
print("Error: " + str(error))
 
def on_close(ws):
print "Connection closed"
print("Connection closed")
 
def main(argv):
commands = { "list-sessions": list_sessions,
"send-text": send_text }
if len(argv) < 2:
print "Not enough arguments"
print("Not enough arguments")
return -1
if argv[1] not in commands:
print "Unrecognized command " + argv[1]
print("Unrecognized command " + argv[1])
return -2
 
def on_open(ws):
Loading
Loading
#!/usr/bin/python
# This is python 2.7 on macOS 10.12.
 
from __future__ import print_function
import api_pb2
import thread
import time
Loading
Loading
@@ -9,8 +11,8 @@ import websocket
callbacks = []
 
def handle_location_change_notification(location_change_notification):
print "Location changed"
print str(location_change_notification)
print("Location changed")
print(str(location_change_notification))
 
def SendRPC(ws, message, callback):
ws.send(message.SerializeToString(), opcode=websocket.ABNF.OPCODE_BINARY)
Loading
Loading
@@ -22,14 +24,14 @@ def handle_notification(notification):
 
def handle_notification_response(response):
if not response.HasField('notification_response'):
print "Malformed notification response"
print str(response)
print("Malformed notification response")
print(str(response))
return
if response.notification_response.status != api_pb2.NotificationResponse.OK:
print "Bad status in notification response"
print str(response)
print("Bad status in notification response")
print(str(response))
return
print "Notifcation response ok"
print("Notifcation response ok")
 
def on_message(ws, message):
response = api_pb2.Response()
Loading
Loading
@@ -43,19 +45,19 @@ def on_message(ws, message):
callback(response)
 
def on_error(ws, error):
print "Error: " + str(error)
print("Error: " + str(error))
 
def on_close(ws):
print "Connection closed"
print("Connection closed")
 
def on_open(ws):
print "Connection opened"
print("Connection opened")
request = api_pb2.Request()
request.notification_request.subscribe = True
request.notification_request.notification_type = api_pb2.NOTIFY_ON_LOCATION_CHANGE
SendRPC(ws, request, handle_notification_response)
 
if __name__ == "__main__":
def main():
websocket.enableTrace(True)
ws = websocket.WebSocketApp("ws://localhost:1912/",
on_message = on_message,
Loading
Loading
@@ -65,3 +67,5 @@ if __name__ == "__main__":
ws.on_open = on_open
ws.run_forever()
 
if __name__ == "__main__":
main()
Loading
Loading
@@ -16,7 +16,7 @@
#import "iTermWarning.h"
#import "NSFileManager+iTerm.h"
#import "NSObject+iTerm.h"
#import "NSStringiTerm.h"
#import "NSStringITerm.h"
 
@interface NMSSHSession(iTerm)
- (id)agent;
Loading
Loading
Loading
Loading
@@ -10,7 +10,7 @@
#import "CapturedOutput.h"
#import "NSDictionary+iTerm.h"
#import "NSObject+iTerm.h"
#import "NSStringiTerm.h"
#import "NSStringITerm.h"
 
static NSString *const kScreenMarkIsPrompt = @"Is Prompt";
static NSString *const kMarkGuidKey = @"Guid";
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment