diff --git a/cmd/cli/commands/list/list.go b/cmd/cli/commands/list/list.go index 330127e..6e6ad74 100644 --- a/cmd/cli/commands/list/list.go +++ b/cmd/cli/commands/list/list.go @@ -71,7 +71,9 @@ func (p *ListCmd) local(includeBackup bool) error { for _, g := range games { fmt.Println("ID:", g.ID) fmt.Println("Name:", g.Name) - fmt.Println("Last Version:", g.Date, "( Version Number", g.Version, ")") + fmt.Println("Last Version:", g.Date) + fmt.Println("Version:", g.Version) + fmt.Println("MD5:", g.MD5) if includeBackup { bk, err := p.Service.AllBackups(g.ID) if err != nil { @@ -108,7 +110,9 @@ func (p *ListCmd) server(url, username, password string, includeBackup bool) err for _, g := range games { fmt.Println("ID:", g.ID) fmt.Println("Name:", g.Name) - fmt.Println("Last Version:", g.Date, "( Version Number", g.Version, ")") + fmt.Println("Last Version:", g.Date) + fmt.Println("Version:", g.Version) + fmt.Println("MD5:", g.MD5) if includeBackup { bk, err := cli.ListArchives(g.ID) if err != nil { diff --git a/cmd/cli/commands/remote/remote.go b/cmd/cli/commands/remote/remote.go index 8bc8186..fa165db 100644 --- a/cmd/cli/commands/remote/remote.go +++ b/cmd/cli/commands/remote/remote.go @@ -78,7 +78,7 @@ func (p *RemoteCmd) print() error { for _, g := range games { r, err := remote.One(g.ID) if err != nil { - return fmt.Errorf("failed to load datastore: %w", err) + continue } cli := client.New(r.URL, "", "") diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index b9ec354..c2577b7 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -1,5 +1,5 @@ package constants -const Version = "0.0.4" +const Version = "0.0.4a" const ApiVersion = 1 diff --git a/pkg/data/data.go b/pkg/data/data.go index ff8063f..417fad3 100644 --- a/pkg/data/data.go +++ b/pkg/data/data.go @@ -36,7 +36,7 @@ func (s *Service) Add(name, path, remote string) (string, error) { ID: gameID.Key(), Name: name, Path: path, - Version: 1, + Version: 0, Date: time.Now(), } @@ -268,6 +268,8 @@ func (l Service) PullBackup(gameID, backupID string, cli *client.Client) error { return fmt.Errorf("failed to pull backup: %w", err) } + + return nil } diff --git a/pkg/repository/repository.go b/pkg/repository/repository.go index 50d5b53..36d1e0a 100644 --- a/pkg/repository/repository.go +++ b/pkg/repository/repository.go @@ -213,6 +213,13 @@ func (l *LazyRepository) Metadata(id GameIdentifier) (Metadata, error) { return Metadata{}, fmt.Errorf("corrupted datastore: failed to parse metadata: %w", err) } + if _, err := os.Stat(filepath.Join(path, "data.tar.gz")); err != nil { + if errors.Is(err, os.ErrNotExist) { + return m, nil + } + return Metadata{}, fmt.Errorf("failed to open archive: %w", err) + } + m.MD5, err = hash.FileMD5(filepath.Join(path, "data.tar.gz")) if err != nil { return Metadata{}, fmt.Errorf("failed to calculate md5: %w", err)