Third party tools support [DONE]

Any wishes
User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: Third party tools support

Post by mike » Tue Jun 21, 2016 1:59 am

Lets put some examples of tested configs here.

Obvious "Open Terminal Here":

Code: Select all

            {
                     "title": "Open System Terminal Here",
                     "path": "/Applications/Utilities/Terminal.app",
                     "parameters": "%r",
                     "shortcut": ""
            } 

User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: Third party tools support

Post by mike » Tue Jun 21, 2016 2:04 am

Synchronize source and target panels with rsync:

Code: Select all

            {
                "title": "rsync Folders",
                "path": "/usr/bin/rsync",
                "parameters": "-va --delete %r %-r",
                "shortcut": ""
            }

User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: Third party tools support

Post by mike » Tue Jun 21, 2016 2:20 am

Open Xcode Merge with focused items:

Code: Select all

            {
                "title": "Xcode Merge",
                "path": "/Applications/Xcode.app/Contents/Developer/usr/bin/opendiff",
                "parameters": "%p %-p",
                "shortcut": ""
            }

User avatar
darek
Posts: 179
Joined: Thu Jul 16, 2015 4:50 pm
Location: Warsaw, Poland
Contact:

Re: Third party tools support

Post by darek » Tue Jun 21, 2016 5:02 pm

Ok, I tried the build and tried setting up Beyond Compare for folder & file diff. I'm getting commands like this:

Code: Select all

/usr/local/bin$ /Applications/Beyond\ Compare.app/Contents/MacOS/bcomp /Users/darek/test1 /Users/darek/test2
And the issues:

* When I launch their command line tool, I always end up with the console open automatically, which makes sense in some cases (manual launch of a console utility), but is an annoying extra step for this case. `bcomp` is probably an console tool so that's why NC is entering the console mode. And I imagine there'd be cases even in this external tools handling where I'd actually want this, but not in this actual case. Perhaps an option in the config file to say "Don't bother me with console view for this command".

* Somehow my current folder always changes after launching external tool... seems like it's automatically set to the last folder I used in the underlying terminal.

* For some reason this doesn't work `"shortcut": "^⌥D"` but this does `"shortcut": "^⇧D"`

* Hot reload of config file works partially, but shortcuts changes don't always catch up and app restart is needed

* An option to limit total number of files would be cool. Here's the scenario: I want to highlight two files in one panel and diff them. So I'm using "parameters": "%P %-P", but I'm getting three arguments for that two selected in one panel and one from the opposite panel. Three arguments trigger three way merge mode, which is not what I want. The only way is to point to two files in two different panels, which isn't always convenient. On the other hand, I don't want to remove the %-P option, since sometimes I do want to diff two files from two different panels :)

Anyways, it's just a quick test. Hopefully my comments make sense :)

User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: Third party tools support

Post by mike » Wed Jun 22, 2016 3:12 am

Hi Darek,

Thanks for trying, it's a very useful feedback.

Yep, currently NC tries to understand - should it run a tool in terminal or in UI environment, this choice is based on a bundle presence.
I'll add some sort of "starting options" later, just now I haven't figured out which ones are necessary.

Speaking of BeyondCompare - maybe using regular app path will work?
I've tried the following:

Code: Select all

            {
                "title": "Beyond Compare",
                "path": "/Applications/Beyond Compare.app",
                "parameters": "/solo %P %-P",
                "shortcut": "^⌥d"
            }    
And it seems to work fine.
* Somehow my current folder always changes after launching external tool... seems like it's automatically set to the last folder I used in the underlying terminal.
Yep, it follows... Perhaps it will be right thing to separate "terminal for external tools" from "regular built-in terminal", like terminal-based external editors works now. Right now external tool starts in regular terminal, and this paths synchronization comes to play.
* For some reason this doesn't work `"shortcut": "^⌥D"` but this does `"shortcut": "^⇧D"`
My bug - Mac's UI extracts Shift modifier from upper-case hotkey letter, like "D", so "^⌥D" implicitly converts into "^⌥⇧D".
I'll write a fix soon, as temporary solution - using lower-case letter will work.
* Hot reload of config file works partially, but shortcuts changes don't always catch up and app restart is needed
Will check and fix.
* An option to limit total number of files would be cool. Here's the scenario: I want to highlight two files in one panel and diff them. So I'm using "parameters": "%P %-P", but I'm getting three arguments for that two selected in one panel and one from the opposite panel. Three arguments trigger three way merge mode, which is not what I want. The only way is to point to two files in two different panels, which isn't always convenient. On the other hand, I don't want to remove the %-P option, since sometimes I do want to diff two files from two different panels :)
Ha, that's interesting!
From my developer's point of view, adding some "global files output limiter", like "%2T", is a matter of an hour.
But here comes the next question - what about ordering?
Lets say parameters string is "%2T %P %-P", with two files selected on source panel and equally two files selected on target panel.
- should it order by position in parameters string, so result of "%2T %P %-P" and "%2T %-P %P" will differ?,
- OR should source/target be criterion here, so "%P" will produce two files regardless of position?
Surely, first variant is easier to implement.
Anyways, it's just a quick test. Hopefully my comments make sense :)
They are!

User avatar
darek
Posts: 179
Joined: Thu Jul 16, 2015 4:50 pm
Location: Warsaw, Poland
Contact:

Re: Third party tools support

Post by darek » Wed Jun 22, 2016 7:02 am

Oh yeah, using .app directly works perfectly. Thanks for the tip! :)

A for the limit on the argument count... For me, at this point, option #1 would work well.

I imagine the second scenario could, in theory, be helpful in situations where command line looks like "tool -option OPTIONALFILE MAINFILE1 MAINFILE2" and assuming that you have to use the -option *before* the main files. But then it'd get more complex anyway, since you'd need a way to actually get rid of the "-option" text as well, so you won't end up with "tool -option MAINFILE1 MAINFILE2" but "tool MAINFILE1 MAINFILE2", so this could get more tricky.

So unless you have a clear idea for a robust system, I guess for now I'd start with simply limiting the total number of arguments and see how it goes later :) And you can do that %2T thing, but perhaps an option in JSON struct would do better? This might be easier to translate to a UI field later, if you decide to make an UI for this feature at all (but personally I wouldn't worry about UI for that until much, much later... people who mess with this kind of config don't need UI; look at Sublime Text, all scripted configs, no problems).

User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: Third party tools support

Post by mike » Thu Jun 23, 2016 5:46 am

Ok, current update:

- fixed UPPERCASE hotkey bug, now "^⌥D" will do what it should.
- fixed on-the-fly hotkeys reloading, now menu items updates correctly.
- new option to limit total files output (first variant from discussion above), I've chosen to put it into parameters string, this seems to be more flexible for the future.
Format is simple: %42T - this will set an appropriate threshold(T), it's position within parameters string does not matter.

Updated BeyondCompare config:

Code: Select all

            {
                "title": "Beyond Compare",
                "path": "/Applications/Beyond Compare.app",
                "parameters": "%2T /solo %P %-P",
                "shortcut": "^⌥D"
            }    
Here it is: http://magnumbytes.com/downloads/previe ... (1644).zip

User avatar
darek
Posts: 179
Joined: Thu Jul 16, 2015 4:50 pm
Location: Warsaw, Poland
Contact:

Re: Third party tools support

Post by darek » Thu Jun 23, 2016 6:10 am

Thanks Mike, looks good now! :)

User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: Third party tools support

Post by mike » Wed Jul 27, 2016 7:02 am

Closing this thread, let's open new ones for ideas on support improvement.

User avatar
darek
Posts: 179
Joined: Thu Jul 16, 2015 4:50 pm
Location: Warsaw, Poland
Contact:

Re: Third party tools support [DONE]

Post by darek » Fri Aug 05, 2016 10:07 am

I don't know why, but now when I'm using "/Applications/Beyond Compare.app" it doesn't work well: when 2 args are given, instead of comparing these files, Beyond Compare simply opens 2 tabs. I did vaguely remember updating BC recently, perhaps they've changed something? Anyway, I had to go back to "/usr/local/bin/bcomp" which means I'm being switched to the terminal after each compare :)

P.S. Oh, and I did type nimblecommander.com/forum to get here! I keep forgetting the magnumbytes.com domain ;) Fortunately it looks like you've set up a redirect. Excellent.

Locked