ryuta46 / vscode-multi-command

Visual Studio Code Plugin named multi-command
MIT License
229 stars 14 forks source link

Auto handle input prompt #83

Closed huehnerlady closed 4 weeks ago

huehnerlady commented 1 month ago

Hi,

I am trying to implement a multi command where I

my keybinding.json looks like this:

    {
        "key": "cmd+alt+ctrl+u",
        "label": "Multi-command: git stash, pull rebase, stash pop",
        "command": "extension.multiCommand.execute",
        "args": { 
            "sequence": [
                "git.stashIncludeUntracked",
                "git.pullRebase",
                "git.stashPopLatest"
            ]
        }
    },

But when I run it I always get the prompt to add a text:

image

I would like to also automate that. How can I do that?

ryuta46 commented 1 month ago

I checked the source of "git.stashIncludeUntracked" command and found that there is no option to avoid the message prompt for stashing unfortunately.

If you can use git command in your environment, you may use "Command Runner" extension to do that. Please also refer the section about "Command Runner" in README.md

{
        "key": "cmd+alt+ctrl+u",
        "command": "extension.multiCommand.execute",
        "args": { 

            "sequence": [
                {
                    "command": "command-runner.run",
                    "args": { "command": "git stash" }
                },

            ]
        }
    }
huehnerlady commented 1 month ago

@ryuta46 thanks for the answer. Unfortunately that command does not seem to work for me.

When I use that I see the terminal opening and the command executing and also the output that it was successful, but the actual file did not get stashed. when I use the same terminal and type the same command I get the same output as I get with the shortcut, but the file also gets stashed.

I also tried with interval, but that doesn't seem to work either. Any idea why?

Here is my command

    {
        "key": "cmd+alt+ctrl+u",
        "label": "Multi-command: git stash, pull rebase, stash pop",
        "command": "extension.multiCommand.execute",
        "interval": 10000,
        "args": { 
            "sequence": [
                {
                    "command": "command-runner.run",
                    "args": { "command": "git stash --include-untracked" }
                },
                "git.pullRebase",
                "git.stashPopLatest"
            ]
        }
    }
ryuta46 commented 1 month ago

Please check the stash command is executed as you expected.

And please don't forget to save the target file before executing any stash try.

huehnerlady commented 4 weeks ago
{
  "key": "cmd+alt+ctrl+u",
  "command": "command-runner.run",
  "args": { "command": "git stash" }
}

works

{
  "key": "cmd+alt+ctrl+u",
  "command": "extension.multiCommand.execute",
  "args": { 
    "sequence": [
      {
        "command": "command-runner.run",
        "args": { "command": "git stash" }
      }
    ]
  }
}

works

    {
        "key": "cmd+alt+ctrl+u",
        "command": "extension.multiCommand.execute",
        "args": { 
            "sequence": [
            {
                "command": "command-runner.run",
                "args": { "command": "git stash" }
            },
                        "git.pullRebase",
                        "git.stashPopLatest"
            ]
        }
    },

doesn't work :(

huehnerlady commented 4 weeks ago

any idea what I can do to fix that?

ryuta46 commented 4 weeks ago

doesn't work :(

Please provide details. What did you expect to happen and what were the results?

huehnerlady commented 4 weeks ago

This one seems to work now, so I do everything manually with command-runner

    {
        "key": "cmd+alt+ctrl+u",
        "command": "extension.multiCommand.execute",
        "args": { 
            "sequence": [
                {
                    "command": "command-runner.run",
                    "args": { "command": "git stash" }
                },
                {
                    "command": "command-runner.run",
                    "args": { "command": "git fetch --prune" }
                },
                {
                    "command": "command-runner.run",
                    "args": { "command": "git pull --rebase" }
                },
                {
                    "command": "command-runner.run",
                    "args": { "command": "git stash pop" }
                }
            ]
        }
    },
huehnerlady commented 4 weeks ago

doesn't work :(

Please provide details. What did you expect to happen and what were the results?

It did not actually stash the items as expected and so when I did the rebase it said I have uncommitted changes and that I need to stash them

huehnerlady commented 4 weeks ago

@ryuta46 thanks for the help, for me the issue would be fixed, unless you want to track something?

ryuta46 commented 4 weeks ago

It's fine. I close this issue.