Add embedded gists & JSON gist data/metadata (#179)

This commit is contained in:
Thomas Miceli
2023-12-21 20:00:04 +01:00
parent 845e28dd59
commit 0753c5cb54
32 changed files with 872 additions and 60 deletions

View File

@ -149,7 +149,7 @@ func GetFileContent(user string, gist string, revision string, filename string,
return content, truncated, nil
}
func GetFileSize(user string, gist string, revision string, filename string) (int64, error) {
func GetFileSize(user string, gist string, revision string, filename string) (uint64, error) {
repositoryPath := RepositoryPath(user, gist)
cmd := exec.Command(
@ -165,7 +165,7 @@ func GetFileSize(user string, gist string, revision string, filename string) (in
return 0, err
}
return strconv.ParseInt(strings.TrimSuffix(string(stdout), "\n"), 10, 64)
return strconv.ParseUint(strings.TrimSuffix(string(stdout), "\n"), 10, 64)
}
func GetLog(user string, gist string, skip int) ([]*Commit, error) {

View File

@ -11,13 +11,14 @@ import (
)
type File struct {
Filename string
Size string
OldFilename string
Content string
Truncated bool
IsCreated bool
IsDeleted bool
Filename string `json:"filename"`
Size uint64 `json:"size"`
HumanSize string `json:"human_size"`
OldFilename string `json:"-"`
Content string `json:"content"`
Truncated bool `json:"truncated"`
IsCreated bool `json:"-"`
IsDeleted bool `json:"-"`
}
type CsvFile struct {