[29828] users/rhwood/MacPorts.Framework

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 11 04:21:28 PDT 2007


Revision: 29828
          http://trac.macosforge.org/projects/macports/changeset/29828
Author:   rhwood at macports.org
Date:     2007-10-11 04:21:28 -0700 (Thu, 11 Oct 2007)

Log Message:
-----------
Add methods depends and exec to implement the MacPorts Tcl API functions mportdepends and mportexec 
Add various ways of calling search to allow for all options or sane defaults to be passed for the search.

Modified Paths:
--------------
    users/rhwood/MacPorts.Framework/MPMacPorts.h
    users/rhwood/MacPorts.Framework/MPMacPorts.m

Modified: users/rhwood/MacPorts.Framework/MPMacPorts.h
===================================================================
--- users/rhwood/MacPorts.Framework/MPMacPorts.h	2007-10-11 11:18:27 UTC (rev 29827)
+++ users/rhwood/MacPorts.Framework/MPMacPorts.h	2007-10-11 11:21:28 UTC (rev 29828)
@@ -22,7 +22,12 @@
 }
 
 - (NSDictionary *)search:(NSString *)query;
-
+- (NSDictionary *)search:(NSString *)query caseSensitive:(BOOL)sensitivity;
+- (NSDictionary *)search:(NSString *)query caseSensitive:(BOOL)sensitivity matchStyle:(NSString *)style;
+- (NSDictionary *)search:(NSString *)query caseSensitive:(BOOL)sensitivity matchStyle:(NSString *)style field:(NSString *)fieldName;
+- (NSArray *)depends:(MPPort *)port;
+- (void)exec:(MPPort *)port withTarget:(NSString *)target;
+	
 - (NSString *)prefix;
 - (NSArray *)sources:(BOOL)refresh;
 - (NSArray *)sources;

Modified: users/rhwood/MacPorts.Framework/MPMacPorts.m
===================================================================
--- users/rhwood/MacPorts.Framework/MPMacPorts.m	2007-10-11 11:18:27 UTC (rev 29827)
+++ users/rhwood/MacPorts.Framework/MPMacPorts.m	2007-10-11 11:21:28 UTC (rev 29828)
@@ -24,13 +24,39 @@
 	[super dealloc];
 }
 
+#pragma MacPorts API
+
 - (NSDictionary *)search:(NSString *)query {
+	return [self search:query caseSensitive:YES];
+}
+
+- (NSDictionary *)search:(NSString *)query caseSensitive:(BOOL)sensitivity {
+	return [self search:query caseSensitive:sensitivity matchStyle:@"regex"];
+}
+
+- (NSDictionary *)search:(NSString *)query caseSensitive:(BOOL)sensitivity matchStyle:(NSString *)style {
+	return [self search:query caseSensitive:sensitivity matchStyle:style field:@"name"];
+}
+
+- (NSDictionary *)search:(NSString *)query caseSensitive:(BOOL)sensitivity matchStyle:(NSString *)style field:(NSString *)fieldName {
 	NSMutableDictionary *result;
 	NSEnumerator *enumerator;
 	id key;
+	NSString *caseSensitivity;
+	if (sensitivity) {
+		caseSensitivity = @"yes";
+	} else {
+		caseSensitivity = @"no";
+	}
 	result = [NSMutableDictionary dictionaryWithDictionary:[interpreter dictionaryFromTclListAsString:[interpreter evaluateArrayAsString:[NSArray arrayWithObjects:
 		@"return [mportsearch",
 		query,
+		@" ",
+		caseSensitivity,
+		@" ",
+		style,
+		@" ",
+		fieldName,
 		@"]",
 		nil]]]];
 	enumerator = [result keyEnumerator];
@@ -40,6 +66,14 @@
 	return [NSDictionary dictionaryWithDictionary:result];
 }
 
+- (NSArray *)depends:(MPPort *)port {
+	return [port depends];
+}
+
+- (void)exec:(MPPort *)port withTarget:(NSString *)target {
+	return [port exec:target];
+}
+
 #pragma settings
 
 - (NSString *)prefix {

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071011/9d32e83a/attachment.html


More information about the macports-changes mailing list