File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 4
4
"encoding/json"
5
5
"errors"
6
6
"fmt"
7
+ "os/user"
7
8
"reflect"
8
9
"sort"
9
10
"strings"
@@ -171,6 +172,12 @@ func listAction(cmd *cobra.Command, args []string) error {
171
172
logrus .Warn ("No instance found. Run `limactl start` to create an instance." )
172
173
}
173
174
175
+ u , err := user .Current ()
176
+ if err != nil {
177
+ return err
178
+ }
179
+ homeDir := u .HomeDir
180
+
174
181
for _ , instName := range instances {
175
182
inst , err := store .Inspect (instName )
176
183
if err != nil {
@@ -180,6 +187,10 @@ func listAction(cmd *cobra.Command, args []string) error {
180
187
if len (inst .Errors ) > 0 {
181
188
logrus .WithField ("errors" , inst .Errors ).Warnf ("instance %q has errors" , instName )
182
189
}
190
+ dir := inst .Dir
191
+ if strings .HasPrefix (dir , homeDir ) {
192
+ dir = strings .Replace (dir , homeDir , "~" , 1 )
193
+ }
183
194
fmt .Fprintf (w , "%s\t %s\t %s\t %s\t %s\t %d\t %s\t %s\t %s\n " ,
184
195
inst .Name ,
185
196
inst .Status ,
@@ -189,7 +200,7 @@ func listAction(cmd *cobra.Command, args []string) error {
189
200
inst .CPUs ,
190
201
units .BytesSize (float64 (inst .Memory )),
191
202
units .BytesSize (float64 (inst .Disk )),
192
- inst . Dir ,
203
+ dir ,
193
204
)
194
205
}
195
206
You can’t perform that action at this time.
0 commit comments