func (rURI *RepoURI) Components() (parts []string) {

	// normalize the path
	path := (*rURI).Path
	path = utils.TrimPrefixWhile(utils.TrimSuffixWhile(path, "/"), "/")
	path = strings.TrimSuffix(path, ".git")
	path = utils.TrimSuffixWhile(path, "/")
	path = reSlash.ReplaceAllString(path, "/")

	// get the host and the username
	host := (*rURI).HostName
	user := (*rURI).User

	// split the path into parts
	if path != "" {
		parts = strings.Split(path, "/")
	} else {
		parts = []string{}
	}

	// prepend (host, [user]) (with user iff a valid user exists)
	if user != "" && user != "git" {
		parts = append([]string{host, user}, parts...)
	} else {
		parts = append([]string{host}, parts...)
	}

	return
}
// Components gets the Components of a Repo URI
Components gets the Components of a Repo URI
// Components gets the Components of a Repo URI
func (rURI *RepoURI) Components() (parts []string) {
	path := (*rURI).Path
	path = utils.TrimPrefixWhile(utils.TrimSuffixWhile(path, "/"), "/")
	path = strings.TrimSuffix(path, ".git")
	path = utils.TrimSuffixWhile(path, "/")
	path = reSlash.ReplaceAllString(path, "/")
	host := (*rURI).HostName
	user := (*rURI).User
	if path != "" {
		parts = strings.Split(path, "/")
	} else {
		parts = []string{}
	}
	if user != "" && user != "git" {
		parts = append([]string{host, user}, parts...)
	} else {
		parts = append([]string{host}, parts...)
	}
	return
}
func ( rURI * RepoURI ) Components ( ) ( parts [ ] string ) { path := ( * rURI ) . Path path = utils . TrimPrefixWhile ( utils . TrimSuffixWhile ( path , " " ) , " " ) path = strings . TrimSuffix ( path , " " ) path = utils . TrimSuffixWhile ( path , " " ) path = reSlash . ReplaceAllString ( path , " " ) host := ( * rURI ) . HostName user := ( * rURI ) . User if path != " " { parts = strings . Split ( path , " " ) } else { parts = [ ] string { } } if user != " " && user != " " { parts = append ( [ ] string { host , user } , parts ... ) } else { parts = append ( [ ] string { host } , parts ... ) } return }
Components gets the Components of a Repo URI
Components gets the Components of a Repo URI
// normalize the path // get the host and the username // split the path into parts // prepend (host, [user]) (with user iff a valid user exists)