NSTask or AScript?
I am new to objetive-c as I came from Java (Android) and then a little of AppleScript.

So my app is making a git commit. BUT as you know the terminal has output that the user may want to see. So should I continue to use my NSTask for behind the scenes stuff, or should I just use AppleScript and let the user carry on from the terminal. Mainly my push.m looks like this :


    #import "Push.h"
    
    @implementation Push
    
    @synthesize test;
    @synthesize dirPath;
    
    
    -(IBAction)chooseFolder:(id)sender{
        
        dirPath = [self get];
        NSArray *array = [dirPath componentsSeparatedByString:@"/"];
        NSString *pub = [array lastObject];
        [projectName setStringValue:pub];
        
        BOOL fileyn = [self check:dirPath];
        
        if(fileyn) {
            
        } else {
            
        }
        
    }
    -(IBAction)pushAction:(id)sender {
        [self push];
        [self push];
    }
    
    -(void)push{ 
        
        if(dirPath == nil || dirPath == @"") {
            [self chooseFolder:nil];
        }
        
        NSString *commitText = [commitMessage stringValue];
        [commitMessage setStringValue:@""];
        commitText = [NSString stringWithFormat:@"%@",commitText];
        
        if (i == 1) {
            
        } else {
            [self runScript:dirPath:@"add" :@"*" :nil];
            [self runScript:dirPath:@"commit" :@"-m" :commitText];
            [self runScript:dirPath:@"push" :@"origin" :@"HEAD"];
        }
        
    }
    
    -(void) runScript:(NSString *) path:(NSString* )cmd1:(NSString *) cmd2:(NSString *) cmd3{
        
        NSTask *aTask = [[NSTask alloc] init];
        
        NSPipe *pipe;
        pipe = [NSPipe pipe];
        [aTask setStandardOutput: pipe];
        
        NSFileHandle *file;
        file = [pipe fileHandleForReading];
        
        NSArray* args = [NSArray arrayWithObjects:cmd1,cmd2,cmd3, nil];
        [aTask setArguments:args];
        [aTask setCurrentDirectoryPath:path];
        [aTask setLaunchPath:@"/usr/local/git/bin/git"];
        [aTask setArguments:args];
        [aTask launch];
        
        [finished setStringValue:@"finished"];
    
    }
        
    -(IBAction)back:(id)sender{
        
        test = [[NSWindowController alloc] initWithWindowNibName:@"POP"];
        [test showWindow:self];
        [window close];
        
    }
    
    
    -(BOOL)check:(NSString *) pow{
        BOOL isFile = [[NSFileManager defaultManager] fileExistsAtPath:pow isDirectory:NO];
        
        return isFile;
    }
    
    
    -(NSString *)get {	
    	
        NSOpenPanel *panel = [NSOpenPanel openPanel];
        [panel setAllowsMultipleSelection:NO];
        [panel setCanChooseDirectories:YES];
        [panel setCanChooseFiles:NO];
        if ([panel runModal] != NSFileHandlingPanelOKButton) return nil;
        return  [[panel directoryURL] path];
    }
    
    @end


So what should I do? Any thing to improve? Thanks in advance!

NSTask or AScript?
===

I am new to objetive-c as I came from Java (Android) and then a little of AppleScript.

So my app is making a git commit. BUT as you know the terminal has output that the user may want to see. So should I continue to use my NSTask for behind the scenes stuff, or should I just use AppleScript and let the user carry on from the terminal. Mainly my push.m looks like this :


    #import "Push.h"
    
    @implementation Push
    
    @synthesize test;
    @synthesize dirPath;
    
    
    -(IBAction)chooseFolder:(id)sender{
        
        dirPath = [self get];
        NSArray *array = [dirPath componentsSeparatedByString:@"/"];
        NSString *pub = [array lastObject];
        [projectName setStringValue:pub];
        
        BOOL fileyn = [self check:dirPath];
        
        if(fileyn) {
            
        } else {
            
        }
        
    }
    -(IBAction)pushAction:(id)sender {
        [self push];
        [self push];
    }
    
    -(void)push{ 
        
        if(dirPath == nil || dirPath == @"") {
            [self chooseFolder:nil];
        }
        
        NSString *commitText = [commitMessage stringValue];
        [commitMessage setStringValue:@""];
        commitText = [NSString stringWithFormat:@"%@",commitText];
        
        if (i == 1) {
            
        } else {
            [self runScript:dirPath:@"add" :@"*" :nil];
            [self runScript:dirPath:@"commit" :@"-m" :commitText];
            [self runScript:dirPath:@"push" :@"origin" :@"HEAD"];
        }
        
    }
    
    -(void) runScript:(NSString *) path:(NSString* )cmd1:(NSString *) cmd2:(NSString *) cmd3{
        
        NSTask *aTask = [[NSTask alloc] init];
        
        NSPipe *pipe;
        pipe = [NSPipe pipe];
        [aTask setStandardOutput: pipe];
        
        NSFileHandle *file;
        file = [pipe fileHandleForReading];
        
        NSArray* args = [NSArray arrayWithObjects:cmd1,cmd2,cmd3, nil];
        [aTask setArguments:args];
        [aTask setCurrentDirectoryPath:path];
        [aTask setLaunchPath:@"/usr/local/git/bin/git"];
        [aTask setArguments:args];
        [aTask launch];
        
        [finished setStringValue:@"finished"];
    
    }
        
    -(IBAction)back:(id)sender{
        
        test = [[NSWindowController alloc] initWithWindowNibName:@"POP"];
        [test showWindow:self];
        [window close];
        
    }
    
    
    -(BOOL)check:(NSString *) pow{
        BOOL isFile = [[NSFileManager defaultManager] fileExistsAtPath:pow isDirectory:NO];
        
        return isFile;
    }
    
    
    -(NSString *)get {	
    	
        NSOpenPanel *panel = [NSOpenPanel openPanel];
        [panel setAllowsMultipleSelection:NO];
        [panel setCanChooseDirectories:YES];
        [panel setCanChooseFiles:NO];
        if ([panel runModal] != NSFileHandlingPanelOKButton) return nil;
        return  [[panel directoryURL] path];
    }
    
    @end


So what should I do? Any thing to improve? Thanks in advance!
