Merge pull request #355 from samalba/312-list-current
cmd/list: better error handling
This commit is contained in:
commit
c717af0403
@ -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) {
|
||||
|
Reference in New Issue
Block a user