Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel-Dorta committed Nov 18, 2019
1 parent 0abcefd commit 8468d6b
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 55 deletions.
6 changes: 3 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ builds:
- 5
- 6
- 7
- id: sort_APPIP01WV4
main: cmd/sort_APPIP01WV4/main.go
binary: bin/sort_APPIP01WV4
- id: APPIP01WV4_sort
main: cmd/APPIP01WV4_sort/main.go
binary: bin/APPIP01WV4_sort
ldflags: -X github.com/Miguel-Dorta/surveillance-cameras/internal.Version={{.Version}}
goos:
- linux
Expand Down
File renamed without changes.
54 changes: 54 additions & 0 deletions cmd/generic_listLargeDirs/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package main

import (
"fmt"
"github.com/Miguel-Dorta/logolang"
"github.com/Miguel-Dorta/surveillance-cameras/internal"
"github.com/Miguel-Dorta/surveillance-cameras/pkg/utils"
"os"
)

const USAGE = "[path-optional]"

var log *logolang.Logger

func init() {
log = logolang.NewLogger()
log.Color = false
log.Level = logolang.LevelInfo
log.Formatter = func(levelName, msg string) string {
if levelName != "ERROR" {
return msg
}
return fmt.Sprintf("[%s] %s", levelName, msg)
}
}

func getArgs() (path string) {
internal.CheckSpecialArgs(os.Args, USAGE)
if len(os.Args) > 2 {
log.Criticalf("Usage: %s %s (use -h for help)", os.Args[0], USAGE)
}

path = "."
if len(os.Args) == 2 {
path = os.Args[1]
}
return path
}

func main() {
path := getArgs()

errFound := false
if err := utils.IterateDir(path, func(f os.FileInfo) {
log.Infof("%s @ IsDir? %t", f.Name(), f.IsDir())
}); err != nil {
log.Errorf("error listing path: %s", err)
errFound = true
}

if errFound {
os.Exit(1)
}
}
File renamed without changes.
52 changes: 0 additions & 52 deletions cmd/listLargeDirs/listLargeDirs.go

This file was deleted.

0 comments on commit 8468d6b

Please sign in to comment.