PackageManager just because
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
646 B

3 years ago
3 years ago
  1. package Filesystem
  2. import (
  3. "PackageManager/Variables"
  4. "fmt"
  5. )
  6. func PrintFiles(files []string, color func(...interface{}) string, showInt bool) {
  7. var (
  8. f string
  9. i int
  10. )
  11. for i, f = range files {
  12. if showInt {
  13. fmt.Printf("\t%d - %s\n", i, color(f))
  14. continue
  15. }
  16. fmt.Printf("\t%s\n", color(f))
  17. }
  18. }
  19. func PrintFilesLength(files []string) {
  20. fmt.Printf("\t%d files found\n", len(files))
  21. }
  22. func PrintFilesOrLength(files []string, color func(...interface{}) string) {
  23. if (Variables.VerboseOutput && len(files) != 0) || (len(files) < 25 && len(files) > 0) {
  24. PrintFiles(files, color, false)
  25. return
  26. }
  27. PrintFilesLength(files)
  28. }