Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open new tab in existing meld instance via a command line

Is there a way to start new file comparison in an existing meld instance with a command line (like terminal) or programmatically.


For example, following two commands start two instances of meld

$ meld ./1/a1.txt ./2/a2.txt &
$ meld ./3/a3.txt ./4/b4.txt &

However, I'd prefer both file comparisons were opened in same instance in different tabs. I don't know the way to obtain it, but I can illustrate what I mean.

I assume that it possible to modify second command (meld ./3/a3.txt ./4/b4.txt &). For example it can help some unknown option,

$ meld --some-option-to-open-in-tab ./3/a3.txt ./4/b4.txt &

or maybe it's possible to write some application that added a file comparison to existing instance of meld

$ MyMeld ./3/a3.txt ./4/b4.txt &
like image 840
Loom Avatar asked Jan 13 '15 16:01

Loom


2 Answers

There is -n undocumented option (or --newtab)

$ meld ./1/a1.txt ./2/a2.txt &
$ meld -n ./3/a3.txt ./4/b4.txt &
like image 193
Loom Avatar answered Sep 29 '22 17:09

Loom


The -n / --newtab command line argument to "Open a new tab in an already running instance" was only introduced in meld version 1.7.0 (7-Nov-2012), so it was not available in version 1.6.1 or older versions. At the time of writing, the current/latest release is meld version 3.21.0 (19-Apr-2020).

Note that this answer is strictly about when the new tab option/flag was added as a command line argument. Tabs themselves where available for use on the meld application's user interface (GUI) well before version 1.7.0

1.7.0 Release Notes: https://gitlab.gnome.org/GNOME/meld/-/commit/da800fe3428410572e28f617f904476712993ab8 "Comparisons can be opened in new tabs (rather than in a new window) from the command line (Kacper Wysocki, Antoine, Kai Willadsen)"

1.7.0 Code Extract: https://gitlab.gnome.org/GNOME/meld/-/blob/1.7.0/meld/meldapp.py

parser.add_option("-n", "--newtab", action="store_true", default=False,
            help=_("Open a new tab in an already running instance"))

Example: 2-way and 3-way file comparison, with results in tabs of same instance

meld file1 file2 &
meld -n file3 file4 file5 &
like image 31
Pay it forward Avatar answered Sep 29 '22 17:09

Pay it forward