From 2333180c1557e781ffe1dd135f796f3ecfd1ea8a Mon Sep 17 00:00:00 2001 From: cf-sujal Date: Fri, 3 Mar 2023 18:55:10 +0545 Subject: [PATCH 1/3] few enhancements in main file --- CHANGELOG.md | 7 +++++++ main.go | 27 +++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a2ddd41 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# ChangeLog + +### [2023-03-03](https://github.com/go-enry/enry/pull/12) + +#### Enhanced + +- Enhancement in the main file. diff --git a/main.go b/main.go index 3d76f89..9d74272 100644 --- a/main.go +++ b/main.go @@ -29,7 +29,7 @@ func main() { jsonFlag := flag.Bool("json", false, "") showVersion := flag.Bool("version", false, "Show the enry version information") allLangs := flag.Bool("all", false, "Show all files, including those identifed as non-programming languages") - progLangs := flag.Bool("prog", false, "Show only files identifed as programming languages only") + progLangs := flag.Bool("prog", false, "Show files identifed as programming languages only") countMode := flag.String("mode", "byte", "the method used to count file size. Available options are: file, line and byte") limitKB := flag.Int64("limit", 16*1024, "Analyse first N KB of the file (-1 means no limit)") flag.Parse() @@ -89,7 +89,6 @@ func main() { if f.IsDir() { return filepath.SkipDir } - return nil } @@ -97,7 +96,7 @@ func main() { return nil } - // TODO(bzz): provide API that mimics lingust CLI output for + // TODO(bzz): provide API that mimics linguist CLI output for // - running ByExtension & ByFilename // - reading the file, if that did not work // - GetLanguage([]Strategy) @@ -242,8 +241,10 @@ func fileCountValues(_ string, files []string) (float64, filelistError) { } func lineCountValues(root string, files []string) (float64, filelistError) { - var filesErr filelistError - var t float64 + var ( + filesErr filelistError + t float64 + ) for _, fName := range files { l, _ := getLines(filepath.Join(root, fName), nil) t += float64(l) @@ -252,8 +253,10 @@ func lineCountValues(root string, files []string) (float64, filelistError) { } func byteCountValues(root string, files []string) (float64, filelistError) { - var filesErr filelistError - var t float64 + var ( + filesErr filelistError + t float64 + ) for _, fName := range files { f, err := os.Open(filepath.Join(root, fName)) if err != nil { @@ -307,11 +310,11 @@ func printFileAnalysis(file string, limit int64, isJSON bool) error { fmt.Printf( `%s: %d lines (%d sloc) - type: %s - mime_type: %s - language: %s - vendored: %t -`, + type: %s + mime_type: %s + language: %s + vendored: %t + `, filepath.Base(file), totalLines, nonBlank, fileType, mimeType, language, vendored, ) return nil From 93459bfcb655edd7d9b9365bd7aa5553122e4533 Mon Sep 17 00:00:00 2001 From: cf-sujal Date: Sat, 4 Mar 2023 09:03:33 +0545 Subject: [PATCH 2/3] undo changes --- main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 9d74272..6107147 100644 --- a/main.go +++ b/main.go @@ -310,11 +310,11 @@ func printFileAnalysis(file string, limit int64, isJSON bool) error { fmt.Printf( `%s: %d lines (%d sloc) - type: %s - mime_type: %s - language: %s - vendored: %t - `, + type: %s + mime_type: %s + language: %s + vendored: %t +`, filepath.Base(file), totalLines, nonBlank, fileType, mimeType, language, vendored, ) return nil From 1ecd33e04db0e7fe6fa5c882b520263ad1fcf978 Mon Sep 17 00:00:00 2001 From: cf-sujal Date: Mon, 6 Mar 2023 13:12:10 +0545 Subject: [PATCH 3/3] remove change log --- CHANGELOG.md | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index a2ddd41..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# ChangeLog - -### [2023-03-03](https://github.com/go-enry/enry/pull/12) - -#### Enhanced - -- Enhancement in the main file.