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 44 "encoding/json"
55 "errors"
66 "fmt"
7+ "os/user"
78 "reflect"
89 "sort"
910 "strings"
@@ -171,6 +172,12 @@ func listAction(cmd *cobra.Command, args []string) error {
171172 logrus .Warn ("No instance found. Run `limactl start` to create an instance." )
172173 }
173174
175+ u , err := user .Current ()
176+ if err != nil {
177+ return err
178+ }
179+ homeDir := u .HomeDir
180+
174181 for _ , instName := range instances {
175182 inst , err := store .Inspect (instName )
176183 if err != nil {
@@ -180,6 +187,10 @@ func listAction(cmd *cobra.Command, args []string) error {
180187 if len (inst .Errors ) > 0 {
181188 logrus .WithField ("errors" , inst .Errors ).Warnf ("instance %q has errors" , instName )
182189 }
190+ dir := inst .Dir
191+ if strings .HasPrefix (dir , homeDir ) {
192+ dir = strings .Replace (dir , homeDir , "~" , 1 )
193+ }
183194 fmt .Fprintf (w , "%s\t %s\t %s\t %s\t %s\t %d\t %s\t %s\t %s\n " ,
184195 inst .Name ,
185196 inst .Status ,
@@ -189,7 +200,7 @@ func listAction(cmd *cobra.Command, args []string) error {
189200 inst .CPUs ,
190201 units .BytesSize (float64 (inst .Memory )),
191202 units .BytesSize (float64 (inst .Disk )),
192- inst . Dir ,
203+ dir ,
193204 )
194205 }
195206
You can’t perform that action at this time.
0 commit comments