sublime_merge icon indicating copy to clipboard operation
sublime_merge copied to clipboard

custom menu item disabled

Open br4nnigan opened this issue 1 year ago • 1 comments

Version info

  • OS: Debian testing
  • Build: 4169

Description

it seems that using any other command than "git" in custom menus leads to the menu item being ignored. Example Commit.sublime-menu:

    [
        {
            "caption": "Show branches containing this commit",
            "command": "git",
            "args": {"argv": ["branch", "-a", "--contains", "$commit"]}
        },
        {
            "caption": "Find merge commit",
            "command": "/home/me/bin/find_merge.sh",
            "args": {"argv": ["$commit"]}
        },
        {
            "caption": "Find merge commit2",
            "command": "/bin/sh",
            "args": {"argv": ["-c", "'commit=$commit && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'"]}
        },
        {
            "caption": "test",
            "command": "sh",
            "args": {"argv": []}
        }
    ]

Only the first one works

br4nnigan avatar May 15 '24 14:05 br4nnigan

G'day @br4nnigan,

Thanks for reaching out!

The command portion of the menu item refers to a Sublime Merge command. Sublime Merge currently doesn't support running ad-hoc processes.

As a temporary work-around you can define a git alias to run your scripts, and then run the associated alias through the git command.

  1. Add your custom alias using the following git command git config alias.customalias '!f() { echo $1; }; f'
  2. Add the associated command definition to your menu file
{
            "caption": "My Custom Command",
            "command": "git",
            "args": {"argv": ["customalias", "$commit"]}
},

Cheers, - Dylan from Sublime HQ

dpjohnst avatar May 16 '24 01:05 dpjohnst