mirror of https://git.jolheiser.com/ugit.git
Compare commits
No commits in common. "c33dfdc42acc068a865200694b804bb21dd0e36e" and "028fde649f14abce9a4589261e4e01dd734b7e0b" have entirely different histories.
c33dfdc42a
...
028fde649f
|
@ -3,7 +3,6 @@ package html
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"path"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type RepoBreadcrumbComponentContext struct {
|
type RepoBreadcrumbComponentContext struct {
|
||||||
|
@ -23,13 +22,13 @@ func (r RepoBreadcrumbComponentContext) crumbs() []breadcrumb {
|
||||||
breadcrumbs := []breadcrumb{
|
breadcrumbs := []breadcrumb{
|
||||||
{
|
{
|
||||||
label: r.Repo,
|
label: r.Repo,
|
||||||
href: fmt.Sprintf("/%s/tree/%s/", r.Repo, r.Ref),
|
href: fmt.Sprintf("/%s/tree/%s", r.Repo, r.Ref),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for idx, part := range parts {
|
for idx, part := range parts {
|
||||||
breadcrumbs = append(breadcrumbs, breadcrumb{
|
breadcrumbs = append(breadcrumbs, breadcrumb{
|
||||||
label: part,
|
label: part,
|
||||||
href: path.Join(breadcrumbs[idx].href, part),
|
href: breadcrumbs[idx].href + "/" + part,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
breadcrumbs[len(breadcrumbs)-1].end = true
|
breadcrumbs[len(breadcrumbs)-1].end = true
|
||||||
|
|
|
@ -12,7 +12,6 @@ import "bytes"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -33,13 +32,13 @@ func (r RepoBreadcrumbComponentContext) crumbs() []breadcrumb {
|
||||||
breadcrumbs := []breadcrumb{
|
breadcrumbs := []breadcrumb{
|
||||||
{
|
{
|
||||||
label: r.Repo,
|
label: r.Repo,
|
||||||
href: fmt.Sprintf("/%s/tree/%s/", r.Repo, r.Ref),
|
href: fmt.Sprintf("/%s/tree/%s", r.Repo, r.Ref),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for idx, part := range parts {
|
for idx, part := range parts {
|
||||||
breadcrumbs = append(breadcrumbs, breadcrumb{
|
breadcrumbs = append(breadcrumbs, breadcrumb{
|
||||||
label: part,
|
label: part,
|
||||||
href: path.Join(breadcrumbs[idx].href, part),
|
href: breadcrumbs[idx].href + "/" + part,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
breadcrumbs[len(breadcrumbs)-1].end = true
|
breadcrumbs[len(breadcrumbs)-1].end = true
|
||||||
|
@ -73,7 +72,7 @@ func repoBreadcrumbComponent(rbcc RepoBreadcrumbComponentContext) templ.Componen
|
||||||
var templ_7745c5c3_Var2 string
|
var templ_7745c5c3_Var2 string
|
||||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(crumb.label)
|
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(crumb.label)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 44, Col: 24}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 43, Col: 24}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
|
@ -100,7 +99,7 @@ func repoBreadcrumbComponent(rbcc RepoBreadcrumbComponentContext) templ.Componen
|
||||||
var templ_7745c5c3_Var4 string
|
var templ_7745c5c3_Var4 string
|
||||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(crumb.label)
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(crumb.label)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 46, Col: 134}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 45, Col: 134}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
|
@ -113,7 +112,7 @@ func repoBreadcrumbComponent(rbcc RepoBreadcrumbComponentContext) templ.Componen
|
||||||
var templ_7745c5c3_Var5 string
|
var templ_7745c5c3_Var5 string
|
||||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(" / ")
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(" / ")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 47, Col: 12}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 46, Col: 12}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"text/tabwriter"
|
|
||||||
|
|
||||||
"go.jolheiser.com/ugit/internal/git"
|
"go.jolheiser.com/ugit/internal/git"
|
||||||
|
|
||||||
|
@ -105,22 +104,10 @@ func Middleware(repoDir string, cloneURL string, port int, gh Hooks) wish.Middle
|
||||||
if err != nil && err != fs.ErrNotExist {
|
if err != nil && err != fs.ErrNotExist {
|
||||||
log.Error("invalid repository", "error", err)
|
log.Error("invalid repository", "error", err)
|
||||||
}
|
}
|
||||||
tw := tabwriter.NewWriter(s, 0, 0, 1, ' ', 0)
|
|
||||||
for _, de := range des {
|
for _, de := range des {
|
||||||
if filepath.Ext(de.Name()) != ".git" {
|
fmt.Fprintln(s, de.Name())
|
||||||
continue
|
fmt.Fprintf(s, "\tgit clone %s/%s\n", cloneURL, de.Name())
|
||||||
}
|
|
||||||
repo, err := git.NewRepo(repoDir, de.Name())
|
|
||||||
visibility := "❓"
|
|
||||||
if err == nil {
|
|
||||||
visibility = "🔓"
|
|
||||||
if repo.Meta.Private {
|
|
||||||
visibility = "🔒"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Fprintf(tw, "%[1]s\t%[3]s\t%[2]s/%[1]s.git\n", strings.TrimSuffix(de.Name(), ".git"), cloneURL, visibility)
|
|
||||||
}
|
}
|
||||||
tw.Flush()
|
|
||||||
}
|
}
|
||||||
sh(s)
|
sh(s)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue