Merge pull request #355 from samalba/312-list-current

cmd/list: better error handling
This commit is contained in:
Sam Alba 2021-04-22 12:11:10 -07:00 committed by GitHub
commit c717af0403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,15 +70,27 @@ func getCurrentDeploymentID(ctx context.Context, store *dagger.Store) string {
lg.Warn().Err(err).Msg("cannot get current working directory")
return ""
}
st, _ := store.LookupDeploymentByPath(ctx, wd)
st, err := store.LookupDeploymentByPath(ctx, wd)
if err != nil {
// Ignore error
return ""
}
if len(st) == 1 {
return st[0].ID
}
return ""
}
func formatPath(p string) string {
usr, _ := user.Current()
usr, err := user.Current()
if err != nil {
// Ignore error
return p
}
dir := usr.HomeDir
if strings.HasPrefix(p, dir) {