@@ -37,16 +37,16 @@ func ttlShow() *cobra.Command {
37
37
RunE : func (cmd * cobra.Command , args []string ) error {
38
38
client , err := createClient (cmd )
39
39
if err != nil {
40
- return err
40
+ return xerrors . Errorf ( "create client: %w" , err )
41
41
}
42
42
organization , err := currentOrganization (cmd , client )
43
43
if err != nil {
44
- return err
44
+ return xerrors . Errorf ( "get current org: %w" , err )
45
45
}
46
46
47
47
workspace , err := client .WorkspaceByOwnerAndName (cmd .Context (), organization .ID , codersdk .Me , args [0 ])
48
48
if err != nil {
49
- return err
49
+ return xerrors . Errorf ( "get workspace: %w" , err )
50
50
}
51
51
52
52
if workspace .TTL == nil {
@@ -69,21 +69,21 @@ func ttlset() *cobra.Command {
69
69
RunE : func (cmd * cobra.Command , args []string ) error {
70
70
client , err := createClient (cmd )
71
71
if err != nil {
72
- return err
72
+ return xerrors . Errorf ( "create client: %w" , err )
73
73
}
74
74
organization , err := currentOrganization (cmd , client )
75
75
if err != nil {
76
- return err
76
+ return xerrors . Errorf ( "get current org: %w" , err )
77
77
}
78
78
79
79
workspace , err := client .WorkspaceByOwnerAndName (cmd .Context (), organization .ID , codersdk .Me , args [0 ])
80
80
if err != nil {
81
- return err
81
+ return xerrors . Errorf ( "get workspace: %w" , err )
82
82
}
83
83
84
84
ttl , err := time .ParseDuration (args [1 ])
85
85
if err != nil {
86
- return err
86
+ return xerrors . Errorf ( "parse ttl: %w" , err )
87
87
}
88
88
89
89
truncated := ttl .Truncate (time .Minute )
@@ -100,7 +100,7 @@ func ttlset() *cobra.Command {
100
100
TTL : & truncated ,
101
101
})
102
102
if err != nil {
103
- return err
103
+ return xerrors . Errorf ( "update workspace ttl: %w" , err )
104
104
}
105
105
106
106
return nil
@@ -117,23 +117,23 @@ func ttlunset() *cobra.Command {
117
117
RunE : func (cmd * cobra.Command , args []string ) error {
118
118
client , err := createClient (cmd )
119
119
if err != nil {
120
- return err
120
+ return xerrors . Errorf ( "create client: %w" , err )
121
121
}
122
122
organization , err := currentOrganization (cmd , client )
123
123
if err != nil {
124
- return err
124
+ return xerrors . Errorf ( "get current org: %w" , err )
125
125
}
126
126
127
127
workspace , err := client .WorkspaceByOwnerAndName (cmd .Context (), organization .ID , codersdk .Me , args [0 ])
128
128
if err != nil {
129
- return err
129
+ return xerrors . Errorf ( "get workspace: %w" , err )
130
130
}
131
131
132
132
err = client .UpdateWorkspaceTTL (cmd .Context (), workspace .ID , codersdk.UpdateWorkspaceTTLRequest {
133
133
TTL : nil ,
134
134
})
135
135
if err != nil {
136
- return err
136
+ return xerrors . Errorf ( "update workspace ttl: %w" , err )
137
137
}
138
138
139
139
_ , _ = fmt .Fprint (cmd .OutOrStdout (), "ttl unset\n " , workspace .Name )
0 commit comments