-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathmain.go
74 lines (67 loc) · 1.52 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// SPDX-License-Identifier: MIT OR Unlicense
package main
import (
"github.com/boyter/lc/processor"
"github.com/spf13/cobra"
"os"
)
//go:generate go run scripts/include.go
func main() {
//f, _ := os.Create("profile.pprof")
//pprof.StartCPUProfile(f)
//defer pprof.StopCPUProfile()
rootCmd := &cobra.Command{
Use: "lc [flags] [files or directories]",
Long: "Check directory/file for licenses and list what license(s) a file is under.\n" +
"Version " + processor.Version + "\n" +
"Ben Boyter <[email protected]>",
Version: processor.Version,
Run: func(cmd *cobra.Command, args []string) {
// process here
process := processor.NewProcess(".")
process.StartProcess()
},
}
flags := rootCmd.PersistentFlags()
flags.BoolVar(
&processor.IncludeBinaryFiles,
"binary",
false,
"set to disable binary file detection",
)
flags.BoolVar(
&processor.IgnoreIgnoreFile,
"no-ignore",
false,
"disables .ignore file logic",
)
flags.BoolVar(
&processor.IgnoreGitIgnore,
"no-gitignore",
false,
"disables .gitignore file logic",
)
flags.BoolVar(
&processor.IncludeHidden,
"hidden",
false,
"include hidden files",
)
flags.StringSliceVarP(
&processor.AllowListExtensions,
"include-ext",
"i",
[]string{},
"limit to file extensions case sensitive [comma separated list: e.g. go,java,js,C,cpp]",
)
flags.StringVarP(
&processor.Format,
"format",
"f",
"tabular",
"set output format [progress, tabular, json, spdx, xlsx, csv]",
)
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}