There isn’t currently a console in Merge; if you’re on Linux you can run it with the --debug
command line argument to open it and have it dump it’s console to the terminal though. In any case there are a couple of reasons why this isn’t working for you.
The first is that arbitrarily named sublime-menu
files aren’t allowed (or more specifically, are just completely ignored). Each of the menus in the application have specifically named files; the menu that pops up when you open the context menu on a commit is Commit.sublime-menu
, the one for branches is Branch.sublime-menu
and so on. There is a list of all of them on this page of the documentation.
The Repository
menu is under the main menu, so your file needs to be named Main.sublime-menu
in this case.
Once you do that, if you happen to be on Linux and use the command above, you see the following in the console every time you try to open the menu:
:0 Unable to parse command: git p4 sync
:0 Unable to parse command: git p4 sync
:0 Unable to parse command: git p4 sync
This is an indication that the command
entry in the menu item is broken. The command
entry in the menu has to be the name of an internal command, but in your example it’s a command line. Based on the message I would guess that the reason it can’t parse the command is that it contains spaces, which is not allowed.
To execute an arbitrary git command you use the git
command with an argv
that tells it what to execute. In the case of your command above, that would look something like this:
[
{
"id": "repository",
"children":
[
{
"caption": "-",
},
{
"caption": "git p4 sync",
"command": "git", "args": {
"argv": ["p4", "sync"]
}
}
]
}
]
Here the command
is git
and the args
for the command contains the argv
argument that specifies what command line should be passed to git
when it executes.
The items that this adds are tacked onto the end of the default menu items:
Because of this, the example above also includes an additional item with just a caption of -
which adds a separator prior to this command when it appears in the menu to give it a little visual separation from the prior items, which is purely optional and up to you.