From 1391f1e8261dc0a816bd7c749e0119ed49fa40f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Tue, 9 Nov 2021 15:37:52 +0100 Subject: [PATCH] Add some tridactyl github commands --- symlinks/bin/git-explore-local | 8 +++++++- symlinks/config/tridactyl/tridactylrc | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/symlinks/bin/git-explore-local b/symlinks/bin/git-explore-local index 4f90840..dd7f08c 100755 --- a/symlinks/bin/git-explore-local +++ b/symlinks/bin/git-explore-local @@ -2,7 +2,13 @@ TEMPDIR=$(mktemp -d) -git clone --depth=1 $1 $TEMPDIR +if [ -z "$2" ]; then + # No branch defined + git clone --depth=1 $1 $TEMPDIR +else + # Branch defined + git clone --depth=1 -b $2 $1 $TEMPDIR +fi cd $TEMPDIR diff --git a/symlinks/config/tridactyl/tridactylrc b/symlinks/config/tridactyl/tridactylrc index da9faa0..47557f8 100644 --- a/symlinks/config/tridactyl/tridactylrc +++ b/symlinks/config/tridactyl/tridactylrc @@ -2,4 +2,11 @@ set theme dark +" Taken from https://github.com/tridactyl/tridactyl/blob/230600ff950e6948225ec03f9b6858e965e37d22/.tridactylrc#L47 +command githubpryank composite js document.getElementById("clone-help-step-1").textContent.replace("git checkout -b", "git checkout -B").replace("git pull ", "git fetch ") + "git reset --hard " + document.getElementById("clone-help-step-1").textContent.split(" ")[3].replace("-","/") | yank + +command githubprexplore js let url = document.getElementById("clone-help-git-url").value; let branch = document.getElementById("clone-help-step-1").children[1].textContent.replace("git checkout -b ", "").split(" ")[0]; tri.native.run("alacritty --command fish -c 'git-explore-local " + url + " " + branch + "'") + +command githubexplorelocal js let url = document.location.href.replace(/https?:\/\//,"git@").replace("/",":").replace(/$/,".git"); tri.native.run("alacritty --command fish -c 'git-explore-local " + url + "'") + source ~/.config/tridactyl/tridactylrc.local