Skip to content

Instantly share code, notes, and snippets.

@oktomus
Last active August 23, 2024 12:18
Show Gist options
  • Save oktomus/e284923a7fce837615bb756a1060e5dc to your computer and use it in GitHub Desktop.
Save oktomus/e284923a7fce837615bb756a1060e5dc to your computer and use it in GitHub Desktop.
Fork custom commands

With custom commands, you are one shortcut away to run commands thanks to the Quick Launch (Ctrl+P, ⌘+P).

Custom commands can be configured in File > Preferences > Custom commands, or by editing the json file custom-commands.json located in AppData/Local/Fork on Windows and ~/Library/Application Support/com.DanPristupov.Fork/custom-commands.json on MacOS.

Please share your own custom commands :)

How to use

Fork commands are posted as comments on this gist. Press CTRL+F to search for commands.

Then, copy-paste the commands you need in custom-commands.json.

Make sure to close Fork before editing the json file.

@tadija
Copy link

tadija commented Jun 28, 2022

"Open PR on Github" (for the selected commit):

{
  "action" : {
    "showOutput" : false,
    "type" : "sh",
    "waitForExit" : true,
    "script" : "pr_id=$(git log --oneline -n 1 $sha | grep -o '(#[0-9]\\+' | cut -c3- | tail -1)\nrepo_url=$(git config remote.origin.url | sed -e 's\/git@\/https:\\\/\\\/\/' -e 's\/\\.git$\/\/' | sed -E 's\/(\\\/\\\/[^:]*):\/\\1\\\/\/')\npr_url=$(echo $repo_url\/pull\/$pr_id)\nopen $pr_url"
  },
  "name" : "Open PR on Github",
  "target" : "revision"
}

@matic1123
Copy link

matic1123 commented Nov 29, 2022

Ill share mine, for MacOS and JB users. Open in Rider and Open in WebStorm custom commands:

  {
    "name" : "Open in Rider",
    "action" : {
      "type" : "sh",
      "script" : "~\/Library\/Application\\ Support\/JetBrains\/Toolbox\/scripts\/rider .",
      "showOutput" : false,
      "waitForExit" : true
    },
    "target" : "repository"
  },
  {
    "target" : "repository",
    "name" : "Open in WebStorm",
    "action" : {
      "showOutput" : false,
      "type" : "sh",
      "waitForExit" : true,
      "script" : "~\/Library\/Application\\ Support\/JetBrains\/Toolbox\/scripts\/webstorm ."
    }
  }

@bbilginn
Copy link

I was looking for some flavour then found this and wanted to share it here :)
fork-dev/TrackerWin#961

@JessyCatterwaul
Copy link

I don't understand what "UI" vs. "Action" is. Is there documentation?

I'm looking to trigger a script upon committing to a specific branch, to perform work locally instead of on a GitHub runner. Is this possible, or will it require triggering a command from the command-P menu?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment