Skip to content

Commit

Permalink
Added support for sub-extentions for files.
Browse files Browse the repository at this point in the history
The list of sub-extentions added are :
routing.ts, routing.tsx, routing.js, routing.jsx, routes.ts, routes.tsx, routes.js, routes.jsx, sln.dotsettings, d.ts, vcxitems.filters, vcxproj.filters, js.map, mjs.map, css.map, spec.ts, e2e-spec.ts, test.ts, ts.snap, spec.tsx, test.tsx, tsx.snap, spec.jsx, test.jsx, jsx.snap, spec.js, e2e-spec.js, test.js, js.snap, tf.json, blade.php, inky.php, gitlab-ci.yml, stories.js, stories.jsx, story.js, story.jsx, stories.ts, stories.tsx, story.ts, story.tsx, azure-pipelines.yml, azure-pipelines.yaml
  • Loading branch information
Yash-Handa committed Nov 1, 2020
1 parent 483c3a3 commit c6c7cf7
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 20 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/Yash-Handa/logo-ls?style=flat-square)
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/Yash-Handa/logo-ls?sort=semver&style=flat-square)
![PRs](https://img.shields.io/badge/PRs-welcome-56cc14?style=flat-square)
[![HitCount](http://hits.dwyl.com/Yash-Handa/logo-ls.svg)](http://hits.dwyl.com/Yash-Handa/logo-ls)
![AUR](https://img.shields.io/aur/version/logo-ls?style=flat-square&logo=Arch-Linux&labelColor=abcdef&label=AUR)
![deb](https://img.shields.io/badge/-Deb%20Package-A81D33?style=flat-square&logo=Debian&link=https://github.com/Yash-Handa/logo-ls/releases/)
![rpm](https://img.shields.io/badge/-RPM%20Package-EE0000?style=flat-square&logo=Red-Hat&link=https://github.com/Yash-Handa/logo-ls/releases/)
Expand Down
8 changes: 8 additions & 0 deletions assets/iconsFiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,14 @@ var Icon_FileName = map[string]*Icon_Info{
".modernizrrc": Icon_Set["modernizr"],
".modernizrrc.js": Icon_Set["modernizr"],
".modernizrrc.json": Icon_Set["modernizr"],
"routing.ts": Icon_Set["routing"],
"routing.tsx": Icon_Set["routing"],
"routing.js": Icon_Set["routing"],
"routing.jsx": Icon_Set["routing"],
"routes.ts": Icon_Set["routing"],
"routes.tsx": Icon_Set["routing"],
"routes.js": Icon_Set["routing"],
"routes.jsx": Icon_Set["routing"],
// ".vfl": Icon_Set["vfl"],
// ".kl": Icon_Set["kl"],
// "project.graphcool": Icon_Set["graphcool"],
Expand Down
9 changes: 9 additions & 0 deletions assets/iconsMap.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,23 @@ var Icon_Set = map[string]*Icon_Info{
"html": {i: "\uf13b", c: [3]uint8{228, 79, 57}}, // html
"markdown": {i: "\uf853", c: [3]uint8{66, 165, 245}}, // markdown
"css": {i: "\uf81b", c: [3]uint8{66, 165, 245}}, // css
"css-map": {i: "\ue749", c: [3]uint8{66, 165, 245}}, // css-map
"sass": {i: "\ue603", c: [3]uint8{237, 80, 122}}, // sass
"less": {i: "\ue60b", c: [3]uint8{2, 119, 189}}, // less
"json": {i: "\ue60b", c: [3]uint8{251, 193, 60}}, // json
"yaml": {i: "\ue60b", c: [3]uint8{244, 68, 62}}, // yaml
"xml": {i: "\uf72d", c: [3]uint8{64, 153, 69}}, // xml
"image": {i: "\uf71e", c: [3]uint8{48, 166, 154}}, // image
"javascript": {i: "\ue74e", c: [3]uint8{255, 202, 61}}, // javascript
"javascript-map": {i: "\ue781", c: [3]uint8{255, 202, 61}}, // javascript-map
"test-jsx": {i: "\uf595", c: [3]uint8{35, 188, 212}}, // test-jsx
"test-js": {i: "\uf595", c: [3]uint8{255, 202, 61}}, // test-js
"react": {i: "\ue7ba", c: [3]uint8{35, 188, 212}}, // react
"react_ts": {i: "\ue7ba", c: [3]uint8{36, 142, 211}}, // react_ts
"settings": {i: "\uf013", c: [3]uint8{66, 165, 245}}, // settings
"typescript": {i: "\ue628", c: [3]uint8{3, 136, 209}}, // typescript
"typescript-def": {i: "\ufbe4", c: [3]uint8{3, 136, 209}}, // typescript-def
"test-ts": {i: "\uf595", c: [3]uint8{3, 136, 209}}, // test-ts
"pdf": {i: "\uf724", c: [3]uint8{244, 68, 62}}, // pdf
"table": {i: "\uf71a", c: [3]uint8{139, 195, 74}}, // table
"visualstudio": {i: "\ue70c", c: [3]uint8{173, 99, 188}}, // visualstudio
Expand All @@ -57,6 +63,7 @@ var Icon_Set = map[string]*Icon_Info{
"cpp": {i: "\ufb71", c: [3]uint8{2, 119, 189}}, // cpp
"go": {i: "\ufcd1", c: [3]uint8{32, 173, 194}}, // go
"go-mod": {i: "\ufcd1", c: [3]uint8{237, 80, 122}}, // go-mod
"go-test": {i: "\ufcd1", c: [3]uint8{255, 213, 79}}, // go-test
"python": {i: "\uf81f", c: [3]uint8{52, 102, 143}}, // python
"python-misc": {i: "\uf820", c: [3]uint8{130, 61, 28}}, // python-misc
"url": {i: "\uf836", c: [3]uint8{66, 165, 245}}, // url
Expand Down Expand Up @@ -185,6 +192,8 @@ var Icon_Set = map[string]*Icon_Info{
"centOS": {i: "\uf304", c: [3]uint8{157, 83, 135}}, // centOS
"alpine": {i: "\uf300", c: [3]uint8{14, 87, 123}}, // alpine
"mint": {i: "\uf30f", c: [3]uint8{125, 190, 58}}, // mint
"routing": {i: "\ufb40", c: [3]uint8{67, 160, 71}}, // routing
"laravel": {i: "\ue73f", c: [3]uint8{248, 80, 81}}, // laravel
"pug": {i: "\ue60e", c: [3]uint8{239, 204, 163}}, // pug (Not supported by nerdFont)
"blink": {i: "\uf72a", c: [3]uint8{249, 169, 60}}, // blink (The Foundry Nuke) (Not supported by nerdFont)
"postcss": {i: "\uf81b", c: [3]uint8{244, 68, 62}}, // postcss (Not supported by nerdFont)
Expand Down
47 changes: 47 additions & 0 deletions assets/iconsSubExt.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package assets

var Icon_SubExt = map[string]*Icon_Info{
"routing.ts": Icon_Set["routing"],
"routing.tsx": Icon_Set["routing"],
"routing.js": Icon_Set["routing"],
"routing.jsx": Icon_Set["routing"],
"routes.ts": Icon_Set["routing"],
"routes.tsx": Icon_Set["routing"],
"routes.js": Icon_Set["routing"],
"routes.jsx": Icon_Set["routing"],
"sln.dotsettings": Icon_Set["settings"],
"d.ts": Icon_Set["typescript-def"],
"vcxitems.filters": Icon_Set["visualstudio"],
"vcxproj.filters": Icon_Set["visualstudio"],
"js.map": Icon_Set["javascript-map"],
"mjs.map": Icon_Set["javascript-map"],
"css.map": Icon_Set["css-map"],
"spec.ts": Icon_Set["test-ts"],
"e2e-spec.ts": Icon_Set["test-ts"],
"test.ts": Icon_Set["test-ts"],
"ts.snap": Icon_Set["test-ts"],
"spec.tsx": Icon_Set["test-jsx"],
"test.tsx": Icon_Set["test-jsx"],
"tsx.snap": Icon_Set["test-jsx"],
"spec.jsx": Icon_Set["test-jsx"],
"test.jsx": Icon_Set["test-jsx"],
"jsx.snap": Icon_Set["test-jsx"],
"spec.js": Icon_Set["test-js"],
"e2e-spec.js": Icon_Set["test-js"],
"test.js": Icon_Set["test-js"],
"js.snap": Icon_Set["test-js"],
"tf.json": Icon_Set["terraform"],
"blade.php": Icon_Set["laravel"],
"inky.php": Icon_Set["laravel"],
"gitlab-ci.yml": Icon_Set["gitlab"],
"stories.js": Icon_Set["storybook"],
"stories.jsx": Icon_Set["storybook"],
"story.js": Icon_Set["storybook"],
"story.jsx": Icon_Set["storybook"],
"stories.ts": Icon_Set["storybook"],
"stories.tsx": Icon_Set["storybook"],
"story.ts": Icon_Set["storybook"],
"story.tsx": Icon_Set["storybook"],
"azure-pipelines.yml": Icon_Set["azure-pipelines"],
"azure-pipelines.yaml": Icon_Set["azure-pipelines"],
}
86 changes: 86 additions & 0 deletions assets/omitted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# The below list of icons are not included as are not currently supported by nerd fonts, If you are interested consider opening PRs on Nerd Fonts repo

icons:
- riot
- autoit
- livescript
- reason
- bucklescript
- mathematica
- wolframlanguage
- nunjucks
- haml
- cucumber
- vfl
- kl
- coldfusion
- cabal
- restql
- kivy
- graphcool
- sbt
- flow
- bithound
- appveyor
- fusebox
- editorconfig
- watchman
- aurelia
- rollup
- hack
- apollo
- nodemon
- webhint
- browserlist
- crystal
- snyk
- drone
- cuda
- dotjs
- sequelize
- gatsby
- wakatime
- circleci
- cloudfoundry
- processing
- wepy
- hcl
- san
- wallaby
- stencil
- red
- webassembly
- foxpro
- jupyter
- ballerina
- racket
- bazel
- mint
- velocity
- prisma
- abc
- istanbul
- lisp
- buildkite
- netlify
- svelte
- nest
- percy
- gitpod
- advpl_prw
- advpl_ptm
- advpl_tlpp
- advpl_include
- tilt
- capacitor
- adonis
- forth
- uml
- meson
- buck
- sml
- nrwl
- imba
- drawio
- sas
- slug
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.15

require (
github.com/go-git/go-git/v5 v5.1.0
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/mattn/go-colorable v0.1.7
github.com/pborman/getopt/v2 v2.0.0
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
)
38 changes: 20 additions & 18 deletions internal/dir/formatterStuff.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ func getSizeInFormate(b int64) string {
func getIcon(name, ext, indicator string) (icon, color string) {
var i *assets.Icon_Info
var ok bool

switch indicator {
case "/":
// send dir related stuff
i, ok = assets.Icon_Dir[strings.ToLower(name+ext)]
if ok {
break
Expand All @@ -126,31 +126,24 @@ func getIcon(name, ext, indicator string) (icon, color string) {
break
}
i = assets.Icon_Def["dir"]
case "*":
// send executable related stuff
default:
i, ok = assets.Icon_FileName[strings.ToLower(name+ext)]
if ok {
i.MakeExe()
break
}

i, ok = assets.Icon_Ext[strings.ToLower(strings.TrimPrefix(ext, "."))]
if ok {
i.MakeExe()
// a special admiration for goLang
if ext == ".go" && strings.HasSuffix(name, "_test") {
i = assets.Icon_Set["go-test"]
break
}

if len(name) == 0 || '.' == name[0] {
i = assets.Icon_Def["hiddenfile"]
i.MakeExe()
break
}
i = assets.Icon_Def["exe"]
default:
// send file related stuff
i, ok = assets.Icon_FileName[strings.ToLower(name+ext)]
if ok {
break
t := strings.Split(name, ".")
if len(t) > 1 && t[0] != "" {
i, ok = assets.Icon_SubExt[strings.ToLower(t[len(t)-1]+ext)]
if ok {
break
}
}

i, ok = assets.Icon_Ext[strings.ToLower(strings.TrimPrefix(ext, "."))]
Expand All @@ -164,5 +157,14 @@ func getIcon(name, ext, indicator string) (icon, color string) {
}
i = assets.Icon_Def["file"]
}

// change icon color if the file is executable
if indicator == "*" {
if i.GetGlyph() == "\uf723" {
i = assets.Icon_Def["exe"]
}
i.MakeExe()
}

return i.GetGlyph(), i.GetColor(1)
}

0 comments on commit c6c7cf7

Please sign in to comment.