Skip to content

Instantly share code, notes, and snippets.

@colstrom
Last active December 9, 2016 19:58
Show Gist options
  • Select an option

  • Save colstrom/b43337d27650a8d12eae0d4bf21bab5b to your computer and use it in GitHub Desktop.

Select an option

Save colstrom/b43337d27650a8d12eae0d4bf21bab5b to your computer and use it in GitHub Desktop.
sanitize-git-remote-url.fish: removes clutter from URLs
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
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