forked from gnachman/iTerm2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Trigger.h
53 lines (43 loc) · 1.5 KB
/
Trigger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// Trigger.h
// iTerm
//
// Created by George Nachman on 9/23/11.
//
#import <Cocoa/Cocoa.h>
@class PTYSession;
extern NSString * const kTriggerRegexKey;
extern NSString * const kTriggerActionKey;
extern NSString * const kTriggerParameterKey;
@interface Trigger : NSObject {
NSString *regex_;
NSString *action_;
NSString *param_;
}
@property (nonatomic, copy) NSString *regex;
@property (nonatomic, copy) NSString *action;
@property (nonatomic, copy) NSString *param;
+ (Trigger *)triggerFromDict:(NSDictionary *)dict;
- (NSString *)action;
// Subclasses should implement:
- (NSString *)title;
- (BOOL)takesParameter;
- (NSString *)paramPlaceholder;
// Returns true if this kind of action takes a parameter.
- (BOOL)takesParameter;
// Returns true if the parameter this action takes is a popupbutton.
- (BOOL)paramIsPopupButton;
// Returns a map from NSNumber(tag) -> NSString(title)
- (NSDictionary *)menuItemsForPoupupButton;
// Index in tagsSortedByValue of "tag".
- (int)indexOfTag:(int)theTag;
// Tag at "index" in tagsSortedByValue.
- (int)tagAtIndex:(int)index;
// Tags in menu;ItemsForPopupButton sorted by value (however the subclass sees fit to sort)
- (NSArray *)tagsSortedByValue;
- (NSString *)paramWithBackreferencesReplacedWithValues:(NSArray *)values;
- (void)tryString:(NSString *)s inSession:(PTYSession *)aSession;
// Subclasses must override this.
- (void)performActionWithValues:(NSArray *)values inSession:(PTYSession *)aSession;
- (NSComparisonResult)compareTitle:(Trigger *)other;
@end