Last active
February 19, 2020 13:24
-
-
Save fliphess/568e29244b21f21fdb84de52480bf52b to your computer and use it in GitHub Desktop.
Revisions
-
fliphess revised this gist
Feb 19, 2020 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ #!/usr/bin/env python3 import os import sys import subprocess -
fliphess created this gist
Jan 15, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/usr/bin/env bash function usage() { cat <<EOF Open current git repo in your browser Arguments: --pipe - Show pipeline --cr - Show container registry --mr - Show merge requests EOF exit 1 } GITLINK="$( git-link | sed -e 's/\.git//' )" if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then usage elif [ "$1" == "--pipe" ] ; then GITLINK="$GITLINK/pipelines" elif [ "$1" == "--cr" ] ; then GITLINK="$GITLINK/container_registry" elif [ "$1" == "--mr" ] ; then GITLINK="$GITLINK/merge_requests" fi /usr/bin/open "$GITLINK" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #!/usr/bin/env python3 import configparser import os import sys import subprocess def main(): try: command = "git remote -v | grep ^origin | awk '/push/ {print $2}'" url = subprocess.check_output(command, shell=True) url = url.decode().strip() except Exception as e: print("Error: {}".format(e)) sys.exit(1) if url.startswith('git@'): url = url.replace(':', '/').replace('git@', 'https://') print(url) if __name__ == "__main__": main()