()
| 11 | ) |
| 12 | |
| 13 | func ListVMNames() []string { |
| 14 | var vmList []string |
| 15 | |
| 16 | userHomeDir, err := os.UserHomeDir() |
| 17 | if err != nil { |
| 18 | return vmList |
| 19 | } |
| 20 | |
| 21 | dirList, err := os.ReadDir(filepath.Join(userHomeDir, ".macpine")) |
| 22 | if err != nil { |
| 23 | return vmList |
| 24 | } |
| 25 | |
| 26 | for _, f := range dirList { |
| 27 | if f.IsDir() { |
| 28 | if f.Name() != "cache" { |
| 29 | vmList = append(vmList, f.Name()) |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | return vmList |
| 35 | } |
| 36 | |
| 37 | // autocomplete with VM Names |
| 38 | func AutoCompleteVMNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
no outgoing calls
no test coverage detected