MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / sortFileList

Function sortFileList

agent/app/service/ssh.go:824–841  ·  view source on GitHub ↗
(fileNames []sshFileItem)

Source from the content-addressed store, hash-verified

822}
823
824func 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
843func parseSSHConfigTree(root string) ([]sshDirective, []sshConfigFile, error) {
844 rootPath, err := filepath.Abs(root)

Callers 1

LoadLogMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected