| 822 | } |
| 823 | |
| 824 | func sortFileList(fileNames []sshFileItem) []sshFileItem { |
| 825 | if len(fileNames) < 2 { |
| 826 | return fileNames |
| 827 | } |
| 828 | if strings.HasPrefix(path.Base(fileNames[0].Name), "secure") { |
| 829 | var itemFile []sshFileItem |
| 830 | sort.Slice(fileNames, func(i, j int) bool { |
| 831 | return fileNames[i].Name > fileNames[j].Name |
| 832 | }) |
| 833 | itemFile = append(itemFile, fileNames[len(fileNames)-1]) |
| 834 | itemFile = append(itemFile, fileNames[:len(fileNames)-1]...) |
| 835 | return itemFile |
| 836 | } |
| 837 | sort.Slice(fileNames, func(i, j int) bool { |
| 838 | return fileNames[i].Name < fileNames[j].Name |
| 839 | }) |
| 840 | return fileNames |
| 841 | } |
| 842 | |
| 843 | func parseSSHConfigTree(root string) ([]sshDirective, []sshConfigFile, error) { |
| 844 | rootPath, err := filepath.Abs(root) |