Last active
December 9, 2016 19:58
-
-
Save colstrom/b43337d27650a8d12eae0d4bf21bab5b to your computer and use it in GitHub Desktop.
sanitize-git-remote-url.fish: removes clutter from URLs
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 characters
| name = sanitize-git-remote-url | |
| author = Chris Olstrom | |
| license = MIT | |
| provides = fish/functions/sanitize-git-remote-url | |
| requires | |
| fish/builtin/end | |
| fish/builtin/function | |
| fish/builtin/set | |
| fish/builtin/string |
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 characters
| function sanitize-git-remote-url --argument url | |
| set --local port ':[[:digit:]]+/' | |
| set --local credentials '^[^@]+@' | |
| set --local protocol '^[+[:alpha:]]+://' | |
| string replace --regex $protocol '' --all $url | string replace --regex $credentials '' | string replace --regex $port '/' | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment