30 Commits
Author SHA1 Message Date
Yash-Handa 8f2e99cccd Updated gorelease pipeline 2020-09-08 23:11:52 +05:30
Yash-Handa a59d69ec3a Merge branch 'master' of github.com:Yash-Handa/logo-ls 2020-09-08 23:02:17 +05:30
Yash-Handa f776e08b70 Added basic goreleaser settings 2020-09-08 23:02:09 +05:30
Yash HandaandGitHub 28797b6281 Update README.md 2020-09-08 04:50:16 +05:30
Yash-Handa 60585a6a50 Added man page. 2020-09-07 13:48:43 +05:30
Yash HandaandGitHub 6ebebf05d6 Update README.md 2020-09-07 11:42:52 +05:30
Yash-Handa ba0f74c973 updated README.md 2020-09-07 11:41:15 +05:30
Yash-Handa 43b0e86ef2 Updated README.md 2020-09-07 06:54:19 +05:30
Yash-Handa 3c630eb4e5 Updated readme.md 2020-09-07 06:52:51 +05:30
Yash-Handa ffcaafbc27 Added pics to README.md 2020-09-07 01:02:12 +05:30
Yash HandaandGitHub 7d58031d73 Update README.md 2020-09-07 00:02:20 +05:30
Yash HandaandGitHub 8f3981f6e0 Update README.md 2020-09-06 23:57:04 +05:30
Yash-Handa 31c6c7aa96 Added Icon-Set image 2020-09-06 23:48:21 +05:30
Yash-Handa 1a227b5054 Using brailEmpty (U+2800) for spaces. 2020-09-06 22:02:55 +05:30
Yash-Handa b600103952 Added dir icons 2020-09-06 21:54:53 +05:30
Yash-Handa aa74d23907 Integrated Icons 2020-09-06 17:35:07 +05:30
Yash-Handa 0af9fd30e2 Added 200+ icons for 430+ ext and 330+ file names 2020-09-06 02:36:03 +05:30
Yash-Handa 4d775273cb tidy the module 2020-09-03 14:49:34 +05:30
Yash-Handa 474402d4f3 Added Complete git support !! 2020-09-03 14:45:31 +05:30
Yash-Handa 38d12c73ab Added git support to long and 1 format 2020-09-02 14:39:00 +05:30
Yash-Handa 8a44a87f95 Added basic git support 2020-09-02 14:31:49 +05:30
Yash-Handa 31972dd18f Added basic git support 2020-09-02 14:30:33 +05:30
Yash-Handa eea000f606 Added time formate flag 2020-08-30 14:25:02 +05:30
Yash-Handa 6679b87c63 Added Recursion 2020-08-30 12:48:45 +05:30
Yash-Handa 78dd15eb08 Updated pre-push with proper error messages 2020-08-30 06:08:08 +05:30
Yash-Handa a1aa1bd4b2 added this builds to pre-push git hook 2020-08-30 04:55:09 +05:30
Yash-Handa c529ae0abb updated pre-commit hook to build binaries 2020-08-29 21:11:17 +05:30
Yash-Handa 825b66af81 Added support for multiple files/ dirs as argument 2020-08-29 20:46:13 +05:30
Yash-Handa 2b6accffa4 Added proper formatting for ls (custom tabwriter) 2020-08-29 11:35:13 +05:30
Yash-Handa 34036520ba Added parent dir (..) 2020-08-28 07:02:27 +05:30
32 changed files with 2570 additions and 53 deletions
+11 -1
View File
@@ -1,7 +1,17 @@
#!/bin/bash
# build the binery
go build
# Update HELP.md file
echo -e "\`\`\`txt" > HELP.md
go run . -? >> HELP.md
./logo-ls -? >> HELP.md
echo -e "\`\`\`" >> HELP.md
exec git add HELP.md
# Update logo-ls.1.gz
help2man -N -I logo-ls.h2m -o logo-ls.1 ./logo-ls
gzip -f logo-ls.1
exec git add logo-ls.1.gz
exit 0
+43
View File
@@ -0,0 +1,43 @@
#!/bin/sh
R_NAME=$1
R_URL=$2
error_exit()
{
if [ "$?" != "0" ]; then
nl=$'\n'
echo "$1""$nl""$2""$nl""$nl""Aborting push to ""$R_NAME"" (""$R_URL"")" 1>&2
exit 1
fi
}
# Build binary for variety of arch
# linux amd64
ERROR=$(go env -w GOOS=linux GOARCH=amd64 2>&1 > /dev/null)
error_exit "Cannot set GOOS=linux and GOARCH=amd64:" "$ERROR"
ERROR=$(go build -o build/logo-ls-linux-amd64 2>&1 > /dev/null)
error_exit "Cannot build logo-ls-linux-amd64:" "$ERROR"
# linux arm64
ERROR=$(go env -w GOOS=linux GOARCH=arm64 2>&1 > /dev/null)
error_exit "Cannot set GOOS=linux and GOARCH=arm64:" "$ERROR"
ERROR=$(go build -o build/logo-ls-linux-arm64 2>&1 > /dev/null)
error_exit "Cannot build logo-ls-linux-arm64:" "$ERROR"
# linux 386
ERROR=$(go env -w GOOS=linux GOARCH=386 2>&1 > /dev/null)
error_exit "Cannot set GOOS=linux and GOARCH=386:" "$ERROR"
ERROR=$(go build -o build/logo-ls-linux-386 2>&1 > /dev/null)
error_exit "Cannot build logo-ls-linux-386:" "$ERROR"
# darwin amd64
ERROR=$(go env -w GOOS=darwin GOARCH=amd64 2>&1 > /dev/null)
error_exit "Cannot set GOOS=darwin and GOARCH=amd64:" "$ERROR"
ERROR=$(go build -o build/logo-ls-darwin-amd64 2>&1 > /dev/null)
error_exit "Cannot build logo-ls-darwin-amd64:" "$ERROR"
# reset env to default
go env -u GOOS GOARCH
exit 0
Binary file not shown.

After

Width:  |  Height:  |  Size: 532 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

+7
View File
@@ -16,3 +16,10 @@
# Do not commit the executable
logo-ls
build/
# distribution directory
dist
# env stuff
*.env
+79
View File
@@ -0,0 +1,79 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
env_files:
github_token: .gh_token.env
project_name: logo-ls
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download
builds:
- env:
- CGO_ENABLED=0
# supported OS
goos:
- linux
# - windows
- darwin
# supported ARCH
goarch:
- amd64
- 386
- arm64
- arm
# OS ARCH combinations to ignore
ignore:
- goos: darwin
goarch: 386
# Set the modified timestamp on the output binaries to the latest commit time.
# Required for producing Reproducible builds
mod_timestamp: '{{ .CommitTimestamp }}'
archives:
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
# override archiving [default tar.gz]
format_overrides:
- goos: windows
format: zip
# wrap the content of archive in a dir
#so when extracting the content will be in a dir
wrap_in_directory: true
# files to be included in the archive + binary
files:
- LICENSE
- HELP.md
- logo-ls.1.gz
# - CHANGELOG.md
checksum:
name_template: '{{ .ProjectName }}_SHA512sums.txt'
algorithm: sha512
signs:
-
cmd: gpg2
# sign the checksum with Yash Handa (logo-ls) <yashhanda7@yahoo.com>
args: ["-u", "0xD9498B225223344C0205FDF528182066BCACCCB2", "--output", "${signature}", "--detach-sign", "${artifact}"]
artifacts: checksum
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '(?i)update Readme.md'
+5
View File
@@ -0,0 +1,5 @@
{
"default": true,
"MD033": false,
"MD013": false
}
+32 -2
View File
@@ -1,22 +1,52 @@
```txt
Usage: logo-ls [-1?aAdgGhlorSstUvVX] [files ...]
List information about the FILEs with ICONS and GIT STATUS (the current dir
by default). Sort entries alphabetically if none of -tvSUX is specified.
Usage: logo-ls [-1?aAcdDgGhiloRrSstUvVX] [-T value] [files ...]
-1 list one file per line.
-? display this help and exit
-?, --help display this help and exit
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
-c, --disable-color
don't color icons, filenames and git status (use this to
print to a file)
-d, --directory list directories themselves, not their contents
-D, --git-status print git status of files
-g like -l, but do not list owner
-G, --no-group in a long listing, don't print group names
-h, --human-readable
with -l and -s, print sizes like 1K 234M 2G etc.
-i, --disable-icon
don't print icons of the files
-l use a long listing format
-o like -l, but do not list group information
-R, --recursive list subdirectories recursively
-r, --reverse reverse order while sorting
-S sort by file size, largest first
-s, --size print the allocated size of each file, in blocks
-t sort by modification time, newest first
-T, --time-style=value
time/date format with -l; see time-style below [Stamp]
-U do not sort; list entries in directory order
-v natural sort of (version) numbers within text
-V, --version output version information and exit
-X sort alphabetically by entry extension
Possible value for --time-style (-T)
ANSIC "Mon Jan _2 15:04:05 2006"
UnixDate "Mon Jan _2 15:04:05 MST 2006"
RubyDate "Mon Jan 02 15:04:05 -0700 2006"
RFC822 "02 Jan 06 15:04 MST"
RFC822Z "02 Jan 06 15:04 -0700"
RFC850 "Monday, 02-Jan-06 15:04:05 MST"
RFC1123 "Mon, 02 Jan 2006 15:04:05 MST"
RFC1123Z "Mon, 02 Jan 2006 15:04:05 -0700"
RFC3339 "2006-01-02T15:04:05Z07:00"
Kitchen "3:04PM"
Stamp "Mon Jan _2 15:04:05" [Default]
StampMilli "Jan _2 15:04:05.000"
Exit status:
0 if OK,
1 if minor problems (e.g., cannot access subdirectory),
2 if serious trouble (e.g., cannot access command-line argument).
```
+99
View File
@@ -1,5 +1,104 @@
![OpenSource](https://img.shields.io/badge/Open%20Source-000000?style=for-the-badge&logo=github)
![go](https://img.shields.io/badge/-Written%20In%20Go-00add8?style=for-the-badge&logo=Go&logoColor=ffffff)
![cli](https://img.shields.io/badge/-Build%20for%20CLI-000000?style=for-the-badge&logo=Powershell&logoColor=ffffff)
# logo-ls
![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})
modern ls command with vscode like file logos. Written in Golang
Command and Arguments supported are listed in [HELP.md](/HELP.md)
## Check the downloaded Resource
receive public key of the signing party
```cmd
$ gpg2 --keyid-format long --keyserver keyserver.ubuntu.com --recv-keys 0x28182066bcacccb2
gpg: key 28182066BCACCCB2: "Yash Handa (logo-ls) <yashhanda7@yahoo.com>" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
```
check the signature on logo-ls_SHA512sums.txt
```cmd
$ gpg2 --keyid-format long --verify logo-ls_SHA512sums.txt.sig logo-ls_SHA512sums.txt
gpg: Signature made Tue 08 Sep 2020 10:21:52 PM IST
gpg: using RSA key D9498B225223344C0205FDF528182066BCACCCB2
gpg: Good signature from "Yash Handa (logo-ls) <yashhanda7@yahoo.com>" [ultimate]
```
A **Good** signature means that the checked file was definitely signed by the owner of the keyfile stated (if they didnt match, the signature would be reported as **BAD**)
Now use `logo-ls_SHA512sums.txt` file to verify the authenticity of the resource downloaded
```cmd
$ sha512sum -c logo-ls_SHA512sums.txt 2>&1 | grep OK
logo-ls_Linux_x86_64.tar.gz: OK
logo-ls_Linux_arm64.tar.gz: OK
logo-ls_Darwin_x86_64.tar.gz: OK
logo-ls_Linux_i386.tar.gz: OK
logo-ls_Linux_armv6.tar.gz: OK
```
Note: The downloaded resources to verify and `logo-ls_SHA512sums.txt` should be in the same directory
## Example Commands
<div>
<span align="center">
<img alt="logo-ls" title="logo-ls" src="/.github/images/ls.png">
</span>
</div><br>
<div>
<span align="center">
<img alt="logo-ls -aD" title="logo-ls -aD" src="/.github/images/ls-aD.png">
</span>
</div><br>
<div>
<span align="center">
<img alt="logo-ls -alhD" title="logo-ls -alhD" src="/.github/images/ls-alhD.png">
</span>
</div><br>
<div>
<span align="center">
<img alt="logo-ls -1Dhs" title="logo-ls -1Dhs" src="/.github/images/ls-1Dhs.png">
</span>
</div><br>
<div>
<span align="center">
<img alt="logo-ls -RD" title="logo-ls -RD" src="/.github/images/ls-RD.png">
</span>
</div><br>
<div>
<span align="center">
<img alt="logo-ls -a" title="logo-ls -a" src="/.github/images/ls-a.png">
</span>
</div><br>
<div>
<span align="center">
<img alt="logo-ls -oahd -T Kitchen" title="logo-ls -oahd -T Kitchen" src="/.github/images/ls-oahD.png">
</span>
</div><br>
## Icon Set
<div>
<span align="center">
<img alt="icons" title="Icon Set" src="/.github/images/icons.png">
</span>
</div><br>
+176
View File
@@ -0,0 +1,176 @@
package ctw
import (
"bytes"
"fmt"
"math"
)
type CTW struct {
d [][]string // entire data passed to ctw
nw []int // widths of each fileName
gw []int // width of each git column
sw []int //width of each size column
ic []string // color of file icon of a row
cols int // zero based no of cols (or total cols -1)
showIcon bool
termW int
}
/* each file comprises of 4 columns
|<---->|<---->|<------------------>|<--------->|
| size | icon | name+ext+indicator | gitStatus |
*/
func New(termW int) *CTW {
t := new(CTW)
t.cols = 3
t.termW = termW
t.nw = make([]int, 0)
t.gw = make([]int, 0)
t.sw = make([]int, 0)
t.d = make([][]string, 0)
t.ic = make([]string, 0)
return t
}
func (w *CTW) AddRow(args ...string) {
// length checking for args
if len(args) != w.cols+1 {
return
}
w.sw = append(w.sw, len(args[0]))
w.nw = append(w.nw, len(args[2]))
w.gw = append(w.gw, len(args[3]))
if w.showIcon == false {
w.showIcon = len(args[1]) > 0
}
w.d = append(w.d, args)
}
func (w *CTW) IconColor(c string) {
w.ic = append(w.ic, c)
}
func (w *CTW) Flush(buf *bytes.Buffer) {
dn := len(w.d)
if dn == 0 {
return
}
pad := 2
iw := make([][4]int, 0) // slice of widths of each column (don't use because it over run once)
var widths [][4]int
prevj := 0 // prevj is previous jump value (row value if you may)
for {
cols := len(iw) + 1
iw = append(iw, [4]int{0, 0, 0, 0})
j := int(math.Ceil(float64(dn) / float64(cols))) // jump value corresponding to cols
if prevj == j { // removes redundant calculations
continue
}
b := 0 // begining of column
e := j // end of column
// find optimal widths (width of each column and total no of columns)
for i := 0; i < cols && e <= dn; i++ {
iw[i] = w.colW(b, e)
b, e = e, e+j
}
// for last column if last column is not complete
if e-j < dn {
iw[cols-1] = w.colW(e-j, dn)
}
prevj = j
totW := widthsSum(iw, pad) //total width of the ls block
if totW > w.termW {
break
} else if totW >= w.termW/2 { // if total width of the ls block is more than half of terminal
// copy iw to widths
widths = make([][4]int, len(iw))
for i := range iw {
widths[i] = iw[i]
}
}
if cols == dn { // if content comes in one line of terminal
// copy widths to prevWidths
widths = make([][4]int, len(iw))
for i := range iw {
widths[i] = iw[i]
}
break
}
}
// total no of rows
rows := int(math.Ceil(float64(dn) / float64(len(widths))))
// loop to write entire ls block to buffer
for i := 0; i < rows; i++ {
p := pad
for j := 0; j < len(widths); j++ {
if i+j*rows >= dn { // checks for last column if incomplete
continue
}
if j == len(widths)-1 {
p = 0
}
w.printCell(buf, i+j*rows, widths[j])
fmt.Fprintf(buf, "%*s", p, "")
}
fmt.Fprintf(buf, "\n")
}
}
func (w *CTW) colW(b, e int) [4]int {
s, n, g := 0, 0, 0 // max od size column, name column, gitStatus column
for i := b; i < e; i++ {
if w.sw[i] > s {
s = w.sw[i]
}
if w.nw[i] > n {
n = w.nw[i]
}
if w.gw[i] > g {
g = w.gw[i]
}
}
ans := [4]int{0, 0, 0, 0}
if s > 0 {
ans[0] = s + 1
}
if w.showIcon {
ans[1] = 2
}
ans[2] = n
if g > 0 {
ans[3] = 2
}
return ans
}
func (w *CTW) printCell(buf *bytes.Buffer, i int, cs [4]int) {
if cs[0] > 0 {
fmt.Fprintf(buf, "%-*s%s", cs[0]-1, w.d[i][0], brailEmpty)
}
if w.showIcon {
fmt.Fprintf(buf, "%s%1s%s%s", w.ic[i], w.d[i][1], white, brailEmpty)
}
fmt.Fprintf(buf, "%s%-*s%s", getGitColor(w.d[i][3]), cs[2], w.d[i][2], white)
if cs[3] > 0 {
fmt.Fprintf(buf, "%s%s%1s%s", brailEmpty, getGitColor(w.d[i][3]), w.d[i][3], white)
}
}
+78
View File
@@ -0,0 +1,78 @@
package ctw
import (
"bytes"
"fmt"
)
type LongCTW struct {
d [][]string // entire data passed to ctw
c []int // widths of each column
ic []string // color of file icon of a row
cols int // zero based no of cols (or total cols -1)
}
func NewLong(cols int) *LongCTW {
t := new(LongCTW)
t.cols = cols - 1
// initialize right size slice
t.c = make([]int, cols)
t.d = make([][]string, 0)
t.ic = make([]string, 0)
return t
}
func (l *LongCTW) AddRow(args ...string) {
// add length checking for args
if len(args) != l.cols+1 {
return
}
for i, v := range args {
if l.c[i] < len(v) {
l.c[i] = len(v)
}
}
l.d = append(l.d, args)
}
func (l *LongCTW) IconColor(c string) {
l.ic = append(l.ic, c)
}
func (l *LongCTW) Flush(buf *bytes.Buffer) {
var skipCol int = 0
for i, v := range l.c {
if v == 0 {
skipCol |= 1 << i
}
}
// explicitly setting git column to 1
l.c[l.cols] = 1
// explicitly setting icon column to 2
l.c[l.cols-2] = 1
for i, r := range l.d {
f := true
for j, c := range r {
if (1<<j)&skipCol > 0 {
continue
}
if f == false {
fmt.Fprintf(buf, "%s", brailEmpty)
}
if j == l.cols-2 {
fmt.Fprintf(buf, "%s%*s%s", l.ic[i], l.c[j], c, white)
} else if j >= l.cols-1 && (1<<l.cols)&skipCol == 0 {
color := getGitColor(r[l.cols])
fmt.Fprintf(buf, "%s%-*s%s", color, l.c[j], c, white)
} else {
fmt.Fprintf(buf, "%-*s", l.c[j], c)
}
f = false
}
fmt.Fprintln(buf)
}
}
+44
View File
@@ -0,0 +1,44 @@
package ctw
import "strings"
var (
white string = "\033[38;2;255;255;255m"
green string = "\033[38;2;055;183;021m"
brown string = "\033[38;2;192;154;107m"
brailEmpty string = "\u2800"
)
func DisplayColor(b bool) {
if b == false {
white = ""
green = ""
brown = ""
}
}
func DisplayBrailEmpty(b bool) {
if b == false {
brailEmpty = " "
}
}
func getGitColor(gitStatus string) string {
switch strings.Trim(gitStatus, " ") {
case "":
return white
case "U":
return green
default:
return brown
}
}
func widthsSum(w [][4]int, p int) int {
s := 0
for _, v := range w {
s += v[0] + v[1] + v[2] + v[3] + p
}
s -= p
return s
}
+164 -26
View File
@@ -4,13 +4,16 @@ package main
import (
"bytes"
"fmt"
"io"
"log"
"os"
"path/filepath"
"sort"
"strings"
"syscall"
"text/tabwriter"
"time"
"github.com/Yash-Handa/logo-ls/ctw"
)
type file struct {
@@ -21,13 +24,18 @@ type file struct {
modeBits uint32
owner, group string // use syscall package
blocks int64 // blocks required by the file multiply buy 512 to get block size
// 'U'-> untracked file 'M'-> Modified file '●'-> modified dir ' '-> Not Updated/ not in git repo
gitStatus string
icon string
iconColor string
}
type dir struct {
info *file
files []*file // all child files and dirs
dirs []*file // for recursion contain only child dirs
less func(int, int) bool
info *file
parent *file
files []*file // all child files and dirs
dirs []string // for recursion contain only child dirs
less func(int, int) bool
}
// define methods on *dir type only not on file type
@@ -40,13 +48,19 @@ func newDir(d *os.File) (*dir, error) {
// filing current dir info
t.info = new(file)
t.info.name = d.Name()
t.info.ext = ""
t.info.name = "."
ds, err := d.Stat()
if err != nil {
return nil, err
}
// getting Git Status of the entire repository
var gitRepoStatus map[string]string // could be nil
if flagVector&flag_D > 0 {
gitRepoStatus = getFilesGitStatus(d.Name()) // returns map or nil
}
if curDir {
ds, err := d.Stat()
if err != nil {
return nil, err
}
t.info.size = ds.Size()
t.info.modTime = ds.ModTime()
if long {
@@ -59,6 +73,12 @@ func newDir(d *os.File) (*dir, error) {
t.info.blocks = s.Blocks
}
}
if flagVector&flag_i == 0 {
t.info.icon = iDef["diropen"].getGlyph()
if flagVector&flag_c == 0 {
t.info.iconColor = iDef["diropen"].getColor(1)
}
}
}
// don't fill files info if the -d flag is passed
@@ -90,14 +110,63 @@ func newDir(d *os.File) (*dir, error) {
f.blocks = s.Blocks
}
}
if flagVector&flag_i == 0 {
f.icon, f.iconColor = getIcon(f.name, f.ext, f.indicator)
if flagVector&flag_c != 0 {
f.iconColor = ""
}
}
if gitRepoStatus != nil {
if v.IsDir() {
f.gitStatus = gitRepoStatus[v.Name()+"/"]
} else {
f.gitStatus = gitRepoStatus[v.Name()]
}
}
t.files = append(t.files, f)
if v.IsDir() {
t.dirs = append(t.dirs, f)
t.dirs = append(t.dirs, name+"/")
}
}
// if -a flag is passed then only eval parent dir and append to files
if flagVector&flag_a > 0 {
t.files = append(t.files, t.info)
p, err := filepath.Abs(d.Name())
if err != nil {
// partial *dir (without parent dir) and error
return t, err
}
pp := filepath.Dir(p)
pds, err := os.Lstat(pp)
if err != nil {
// partial *dir (without parent dir) and error
return t, err
}
t.parent = new(file)
t.parent.name = ".."
t.parent.size = pds.Size()
t.parent.modTime = pds.ModTime()
if long {
t.parent.mode = pds.Mode().String()
t.parent.modeBits = uint32(pds.Mode())
t.parent.owner, t.parent.group = getOwnerGroupInfo(pds)
}
if flagVector&flag_s > 0 {
if s, ok := pds.Sys().(*syscall.Stat_t); ok {
t.parent.blocks = s.Blocks
}
}
if flagVector&flag_i == 0 {
t.parent.icon = iDef["diropen"].getGlyph()
if flagVector&flag_c == 0 {
t.parent.iconColor = iDef["diropen"].getColor(1)
}
}
t.files = append(t.files, t.parent)
}
// return *dir with no error
@@ -105,6 +174,71 @@ func newDir(d *os.File) (*dir, error) {
return t, err
}
func newDir_ArgFiles(files []os.FileInfo) *dir {
var long bool = flagVector&(flag_l|flag_o|flag_g) > 0
t := new(dir)
for _, v := range files {
name := v.Name()
f := new(file)
f.ext = filepath.Ext(name)
f.name = name[0 : len(name)-len(f.ext)]
f.indicator = getIndicator(v.Mode())
f.size = v.Size()
f.modTime = v.ModTime()
if long {
f.mode = v.Mode().String()
f.modeBits = uint32(v.Mode())
f.owner, f.group = getOwnerGroupInfo(v)
}
if flagVector&flag_s > 0 {
if s, ok := v.Sys().(*syscall.Stat_t); ok {
f.blocks = s.Blocks
}
}
if flagVector&flag_i == 0 {
f.icon, f.iconColor = getIcon(f.name, f.ext, f.indicator)
if flagVector&flag_c != 0 {
f.iconColor = ""
}
}
t.files = append(t.files, f)
}
return t
}
func newDirs_Recussion(d *os.File) {
dd, err := newDir(d)
d.Close()
if err != nil {
log.Printf("partial access to %q: %v\n", d.Name(), err)
_ = set_osExitCode(code_Minor)
}
// print the info of the files of the directory
io.Copy(os.Stdout, dd.print())
if len(dd.dirs) == 0 {
return
}
// at this point dd.print has sorted the children files
// but not using it instead printing children in directory order
temp := make([]string, len(dd.dirs))
for i, v := range dd.dirs {
temp[i] = filepath.Join(d.Name(), v)
}
for _, v := range temp {
fmt.Printf("\n%s:\n", openDir+v)
f, err := os.Open(v)
if err != nil {
log.Printf("cannot access %q: %v\n", v, err)
f.Close()
_ = set_osExitCode(code_Minor)
continue
}
newDirs_Recussion(f)
}
}
func (d *dir) print() *bytes.Buffer {
// take care of printing, extending symbolic links in long forms
@@ -117,37 +251,41 @@ func (d *dir) print() *bytes.Buffer {
}
buf := bytes.NewBuffer([]byte(""))
var w *tabwriter.Writer
switch {
case flagVector&(flag_l|flag_o|flag_g) > 0:
w = tabwriter.NewWriter(buf, 0, 0, 1, ' ', tabwriter.DiscardEmptyColumns)
fmtStr := "%s\t%s\t%s\t%s\t%s\t%s\t\n"
w := ctw.NewLong(9)
for _, v := range d.files {
if flagVector&flag_s > 0 {
fmt.Fprintf(w, "%s\t", getSizeInFormate(v.blocks*512))
w.AddRow(getSizeInFormate(v.blocks*512), v.mode, v.owner, v.group, getSizeInFormate(v.size), v.modTime.Format(timeFormate), v.icon, v.name+v.ext+v.indicator, v.gitStatus)
} else {
w.AddRow("", v.mode, v.owner, v.group, getSizeInFormate(v.size), v.modTime.Format(timeFormate), v.icon, v.name+v.ext+v.indicator, v.gitStatus)
}
fmt.Fprintf(w, fmtStr, v.mode, v.owner, v.group, getSizeInFormate(v.size), v.modTime.Format(time.Stamp), v.name+v.ext+v.indicator)
w.IconColor(v.iconColor)
}
w.Flush(buf)
case flagVector&flag_1 > 0:
w = tabwriter.NewWriter(buf, 0, 0, 1, ' ', tabwriter.DiscardEmptyColumns)
w := ctw.NewLong(4)
for _, v := range d.files {
if flagVector&flag_s > 0 {
fmt.Fprintf(w, "%s\t", getSizeInFormate(v.blocks*512))
w.AddRow(getSizeInFormate(v.blocks*512), v.icon, v.name+v.ext+v.indicator, v.gitStatus)
} else {
w.AddRow("", v.icon, v.name+v.ext+v.indicator, v.gitStatus)
}
fmt.Fprintf(w, "%s\t\n", v.name+v.ext+v.indicator)
w.IconColor(v.iconColor)
}
w.Flush(buf)
default:
w = tabwriter.NewWriter(buf, 0, 0, 2, ' ', tabwriter.DiscardEmptyColumns)
w := ctw.New(terminalWidth)
for _, v := range d.files {
s := ""
if flagVector&flag_s > 0 {
s = getSizeInFormate(v.blocks*512) + " "
w.AddRow(getSizeInFormate(v.blocks*512), v.icon, v.name+v.ext+v.indicator, v.gitStatus)
} else {
w.AddRow("", v.icon, v.name+v.ext+v.indicator, v.gitStatus)
}
fmt.Fprintf(w, "%s\t", s+v.name+v.ext+v.indicator)
w.IconColor(v.iconColor)
}
fmt.Fprintln(w)
w.Flush(buf)
}
w.Flush()
return buf
}
+51 -2
View File
@@ -10,6 +10,16 @@ import (
)
func mainSort(a, b string) bool {
switch a {
case ".", "..":
default:
a = strings.TrimPrefix(a, ".")
}
switch b {
case ".", "..":
default:
b = strings.TrimPrefix(b, ".")
}
return strings.ToLower(a) < strings.ToLower(b)
}
@@ -107,14 +117,14 @@ func getIndicator(modebit os.FileMode) (i string) {
switch {
case modebit&os.ModeDir > 0:
i = "/"
case modebit&1000000 > 0:
i = "*"
case modebit&os.ModeNamedPipe > 0:
i = "|"
case modebit&os.ModeSymlink > 0:
i = "@"
case modebit&os.ModeSocket > 0:
i = "="
case modebit&1000000 > 0:
i = "*"
}
return i
}
@@ -136,3 +146,42 @@ func getSizeInFormate(b int64) string {
return fmt.Sprintf("%.1f%c",
float64(b)/float64(div), "KMGTPE"[exp])
}
func getIcon(name, ext, indicator string) (icon, color string) {
var i *iInfo
var ok bool
switch indicator {
case "/":
// send dir related stuff
i, ok = Icon_Dir[strings.ToLower(name+ext)]
if ok {
break
}
if len(name) == 0 || '.' == name[0] {
i = iDef["hiddendir"]
break
}
i = iDef["dir"]
case "*":
// send executable related stuff
i = iDef["exe"]
default:
// send file related stuff
i, ok = Icon_FileName[strings.ToLower(name+ext)]
if ok {
break
}
i, ok = Icon_Ext[strings.ToLower(strings.TrimPrefix(ext, "."))]
if ok {
break
}
if len(name) == 0 || '.' == name[0] {
i = iDef["hiddenfile"]
break
}
i = iDef["file"]
}
return i.getGlyph(), i.getColor(1)
}
+70
View File
@@ -0,0 +1,70 @@
package main
import (
"path/filepath"
"strings"
"github.com/go-git/go-git/v5"
)
func getRepoStatus(path string) (git.Status, string, error) {
op := git.PlainOpenOptions{DetectDotGit: true}
r, err := git.PlainOpenWithOptions(path, &op)
if err != nil {
return nil, "", err
}
w, err := r.Worktree()
if err != nil {
return nil, "", err
}
ws, err := w.Status()
if err != nil {
return nil, "", err
}
return ws, w.Filesystem.Root(), nil
}
func getFilesGitStatus(p string) map[string]string {
gitRepo, gitRoot, err := getRepoStatus(p)
if err != nil {
return nil
}
pAbs, err := filepath.Abs(p)
if err != nil {
return nil
}
t := make(map[string]string)
for i, v := range gitRepo {
i = gitFilePath(gitRoot+"/"+i, pAbs+"/")
if i == "" {
continue
}
dirs := strings.SplitAfter(i, "/")
d := ""
for j, seg := range dirs {
if j == len(dirs)-1 {
if v.Worktree == '?' {
t[i] = "U"
} else {
t[i] = string(v.Worktree)
}
} else {
d += seg
t[d] = "●"
}
}
}
return t
}
func gitFilePath(gitpath, dirpath string) string {
if strings.HasPrefix(gitpath, dirpath) {
return strings.TrimPrefix(gitpath, dirpath)
}
return ""
}
+5 -1
View File
@@ -2,4 +2,8 @@ module github.com/Yash-Handa/logo-ls
go 1.15
require github.com/pborman/getopt/v2 v2.0.0
require (
github.com/go-git/go-git/v5 v5.1.0
github.com/pborman/getopt/v2 v2.0.0
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
)
+80
View File
@@ -1,2 +1,82 @@
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
github.com/go-git/go-billy/v5 v5.0.0 h1:7NQHvd9FVid8VL4qVUMm8XifBK+2xCoZ2lSk0agRrHM=
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
github.com/go-git/go-git-fixtures/v4 v4.0.1 h1:q+IFMfLx200Q3scvt2hN79JsEzy4AmBTp/pqnefH+Bc=
github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw=
github.com/go-git/go-git/v5 v5.1.0 h1:HxJn9g/E7eYvKW3Fm7Jt4ee8LXfPOm/H1cdDu8vEssk=
github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJAozQrZuyM=
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg=
github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd h1:Coekwdh0v2wtGp9Gmz1Ze3eVRAWJMLokvN3QjdzCHLY=
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/pborman/getopt/v2 v2.0.0 h1:Tn8XVmhb93Wbc346Tk4P6KutfpMVp+iztUzkZrTSyB4=
github.com/pborman/getopt/v2 v2.0.0/go.mod h1:4NtW75ny4eBw9fO1bhtNdYTlZKYX5/tBLtsOpwKIKd0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70=
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+61
View File
@@ -0,0 +1,61 @@
package main
var Icon_Dir = map[string]*iInfo{
"config": iSet["dir-config"],
".config": iSet["dir-config"],
"configs": iSet["dir-config"],
"configuration": iSet["dir-config"],
"configurations": iSet["dir-config"],
"settings": iSet["dir-config"],
".settings": iSet["dir-config"],
"META-INF": iSet["dir-config"],
"controller": iSet["dir-controller"],
"controllers": iSet["dir-controller"],
"service": iSet["dir-controller"],
"services": iSet["dir-controller"],
"provider": iSet["dir-controller"],
"providers": iSet["dir-controller"],
".git": iSet["dir-git"],
"githooks": iSet["dir-git"],
".githooks": iSet["dir-git"],
"submodules": iSet["dir-git"],
".submodules": iSet["dir-git"],
".github": iSet["dir-github"],
"node_modules": iSet["dir-npm"],
"include": iSet["dir-include"],
"includes": iSet["dir-include"],
"_includes": iSet["dir-include"],
"import": iSet["dir-import"],
"imports": iSet["dir-import"],
"imported": iSet["dir-import"],
"uploads": iSet["dir-upload"],
"upload": iSet["dir-upload"],
"downloads": iSet["dir-download"],
"download": iSet["dir-download"],
"auth": iSet["dir-secure"],
"authentication": iSet["dir-secure"],
"secure": iSet["dir-secure"],
"security": iSet["dir-secure"],
"cert": iSet["dir-secure"],
"certs": iSet["dir-secure"],
"certificate": iSet["dir-secure"],
"certificates": iSet["dir-secure"],
"ssl": iSet["dir-secure"],
"images": iSet["dir-images"],
"image": iSet["dir-images"],
"pics": iSet["dir-images"],
"pic": iSet["dir-images"],
"pictures": iSet["dir-images"],
"picture": iSet["dir-images"],
"img": iSet["dir-images"],
"icons": iSet["dir-images"],
"icon": iSet["dir-images"],
"ico": iSet["dir-images"],
"screenshot": iSet["dir-images"],
"screenshots": iSet["dir-images"],
".env": iSet["dir-environment"],
".environment": iSet["dir-environment"],
"env": iSet["dir-environment"],
"environment": iSet["dir-environment"],
"environments": iSet["dir-environment"],
}
+530
View File
@@ -0,0 +1,530 @@
package main
var Icon_Ext = map[string]*iInfo{
"htm": iSet["html"],
"html": iSet["html"],
"xhtml": iSet["html"],
"html_vm": iSet["html"],
"asp": iSet["html"],
"jade": iSet["pug"],
"pug": iSet["pug"],
"md": iSet["markdown"],
"markdown": iSet["markdown"],
"rst": iSet["markdown"],
"blink": iSet["blink"],
"css": iSet["css"],
"scss": iSet["sass"],
"sass": iSet["sass"],
"less": iSet["less"],
"json": iSet["json"],
"tsbuildinfo": iSet["json"],
"json5": iSet["json"],
"jsonl": iSet["json"],
"ndjson": iSet["json"],
"jinja": iSet["jinja"],
"jinja2": iSet["jinja"],
"j2": iSet["jinja"],
"jinja-html": iSet["jinja"],
"sublime-project": iSet["sublime"],
"sublime-workspace": iSet["sublime"],
"yaml": iSet["yaml"],
"yaml-tmlanguage": iSet["yaml"],
"yml": iSet["yaml"],
"xml": iSet["xml"],
"plist": iSet["xml"],
"xsd": iSet["xml"],
"dtd": iSet["xml"],
"xsl": iSet["xml"],
"xslt": iSet["xml"],
"resx": iSet["xml"],
"iml": iSet["xml"],
"xquery": iSet["xml"],
"tmLanguage": iSet["xml"],
"manifest": iSet["xml"],
"project": iSet["xml"],
"png": iSet["image"],
"jpeg": iSet["image"],
"jpg": iSet["image"],
"gif": iSet["image"],
"ico": iSet["image"],
"tif": iSet["image"],
"tiff": iSet["image"],
"psd": iSet["image"],
"psb": iSet["image"],
"ami": iSet["image"],
"apx": iSet["image"],
"bmp": iSet["image"],
"bpg": iSet["image"],
"brk": iSet["image"],
"cur": iSet["image"],
"dds": iSet["image"],
"dng": iSet["image"],
"exr": iSet["image"],
"fpx": iSet["image"],
"gbr": iSet["image"],
"img": iSet["image"],
"jbig2": iSet["image"],
"jb2": iSet["image"],
"jng": iSet["image"],
"jxr": iSet["image"],
"pbm": iSet["image"],
"pgf": iSet["image"],
"pic": iSet["image"],
"raw": iSet["image"],
"webp": iSet["image"],
"eps": iSet["image"],
"afphoto": iSet["image"],
"ase": iSet["image"],
"aseprite": iSet["image"],
"clip": iSet["image"],
"cpt": iSet["image"],
"heif": iSet["image"],
"heic": iSet["image"],
"kra": iSet["image"],
"mdp": iSet["image"],
"ora": iSet["image"],
"pdn": iSet["image"],
"reb": iSet["image"],
"sai": iSet["image"],
"tga": iSet["image"],
"xcf": iSet["image"],
"js": iSet["javascript"],
"esx": iSet["javascript"],
"mj": iSet["javascript"],
"jsx": iSet["react"],
"tsx": iSet["react_ts"],
"ini": iSet["settings"],
"dlc": iSet["settings"],
"dll": iSet["settings"],
"config": iSet["settings"],
"conf": iSet["settings"],
"properties": iSet["settings"],
"prop": iSet["settings"],
"settings": iSet["settings"],
"option": iSet["settings"],
"props": iSet["settings"],
"toml": iSet["settings"],
"prefs": iSet["settings"],
"dotsettings": iSet["settings"],
"cfg": iSet["settings"],
"ts": iSet["typescript"],
"marko": iSet["markojs"],
"pdf": iSet["pdf"],
"xlsx": iSet["table"],
"xls": iSet["table"],
"csv": iSet["table"],
"tsv": iSet["table"],
"vscodeignore": iSet["vscode"],
"vsixmanifest": iSet["vscode"],
"vsix": iSet["vscode"],
"code-workplace": iSet["vscode"],
"csproj": iSet["visualstudio"],
"ruleset": iSet["visualstudio"],
"sln": iSet["visualstudio"],
"suo": iSet["visualstudio"],
"vb": iSet["visualstudio"],
"vbs": iSet["visualstudio"],
"vcxitems": iSet["visualstudio"],
"vcxproj": iSet["visualstudio"],
"pdb": iSet["database"],
"sql": iSet["mysql"],
"pks": iSet["database"],
"pkb": iSet["database"],
"accdb": iSet["database"],
"mdb": iSet["database"],
"sqlite": iSet["sqlite"],
"sqlite3": iSet["sqlite"],
"pgsql": iSet["postgresql"],
"postgres": iSet["postgresql"],
"psql": iSet["postgresql"],
"cs": iSet["csharp"],
"csx": iSet["csharp"],
"qs": iSet["qsharp"],
"zip": iSet["zip"],
"tar": iSet["zip"],
"gz": iSet["zip"],
"xz": iSet["zip"],
"br": iSet["zip"],
"bzip2": iSet["zip"],
"gzip": iSet["zip"],
"brotli": iSet["zip"],
"7z": iSet["zip"],
"rar": iSet["zip"],
"tgz": iSet["zip"],
"vala": iSet["vala"],
"zig": iSet["zig"],
"exe": iSet["exe"],
"msi": iSet["exe"],
"java": iSet["java"],
"jar": iSet["java"],
"jsp": iSet["java"],
"c": iSet["c"],
"m": iSet["c"],
"i": iSet["c"],
"mi": iSet["c"],
"h": iSet["h"],
"cc": iSet["cpp"],
"cpp": iSet["cpp"],
"cxx": iSet["cpp"],
"c++": iSet["cpp"],
"cp": iSet["cpp"],
"mm": iSet["cpp"],
"mii": iSet["cpp"],
"ii": iSet["cpp"],
"hh": iSet["hpp"],
"hpp": iSet["hpp"],
"hxx": iSet["hpp"],
"h++": iSet["hpp"],
"hp": iSet["hpp"],
"tcc": iSet["hpp"],
"inl": iSet["hpp"],
"go": iSet["go"],
"py": iSet["python"],
"pyc": iSet["python-misc"],
"whl": iSet["python-misc"],
"url": iSet["url"],
"sh": iSet["console"],
"ksh": iSet["console"],
"csh": iSet["console"],
"tcsh": iSet["console"],
"zsh": iSet["console"],
"bash": iSet["console"],
"bat": iSet["console"],
"cmd": iSet["console"],
"awk": iSet["console"],
"fish": iSet["console"],
"ps1": iSet["powershell"],
"psm1": iSet["powershell"],
"psd1": iSet["powershell"],
"ps1xml": iSet["powershell"],
"psc1": iSet["powershell"],
"pssc": iSet["powershell"],
"gradle": iSet["gradle"],
"doc": iSet["word"],
"docx": iSet["word"],
"rtf": iSet["word"],
"cer": iSet["certificate"],
"cert": iSet["certificate"],
"crt": iSet["certificate"],
"pub": iSet["key"],
"key": iSet["key"],
"pem": iSet["key"],
"asc": iSet["key"],
"gpg": iSet["key"],
"woff": iSet["font"],
"woff2": iSet["font"],
"ttf": iSet["font"],
"eot": iSet["font"],
"suit": iSet["font"],
"otf": iSet["font"],
"bmap": iSet["font"],
"fnt": iSet["font"],
"odttf": iSet["font"],
"ttc": iSet["font"],
"font": iSet["font"],
"fonts": iSet["font"],
"sui": iSet["font"],
"ntf": iSet["font"],
"mrf": iSet["font"],
"lib": iSet["lib"],
"bib": iSet["lib"],
"rb": iSet["ruby"],
"erb": iSet["ruby"],
"fs": iSet["fsharp"],
"fsx": iSet["fsharp"],
"fsi": iSet["fsharp"],
"fsproj": iSet["fsharp"],
"swift": iSet["swift"],
"ino": iSet["arduino"],
"dockerignore": iSet["docker"],
"dockerfile": iSet["docker"],
"tex": iSet["tex"],
"sty": iSet["tex"],
"dtx": iSet["tex"],
"ltx": iSet["tex"],
"pptx": iSet["powerpoint"],
"ppt": iSet["powerpoint"],
"pptm": iSet["powerpoint"],
"potx": iSet["powerpoint"],
"potm": iSet["powerpoint"],
"ppsx": iSet["powerpoint"],
"ppsm": iSet["powerpoint"],
"pps": iSet["powerpoint"],
"ppam": iSet["powerpoint"],
"ppa": iSet["powerpoint"],
"webm": iSet["video"],
"mkv": iSet["video"],
"flv": iSet["video"],
"vob": iSet["video"],
"ogv": iSet["video"],
"ogg": iSet["video"],
"gifv": iSet["video"],
"avi": iSet["video"],
"mov": iSet["video"],
"qt": iSet["video"],
"wmv": iSet["video"],
"yuv": iSet["video"],
"rm": iSet["video"],
"rmvb": iSet["video"],
"mp4": iSet["video"],
"m4v": iSet["video"],
"mpg": iSet["video"],
"mp2": iSet["video"],
"mpeg": iSet["video"],
"mpe": iSet["video"],
"mpv": iSet["video"],
"m2v": iSet["video"],
"vdi": iSet["virtual"],
"vbox": iSet["virtual"],
"vbox-prev": iSet["virtual"],
"ics": iSet["email"],
"mp3": iSet["audio"],
"flac": iSet["audio"],
"m4a": iSet["audio"],
"wma": iSet["audio"],
"aiff": iSet["audio"],
"coffee": iSet["coffee"],
"cson": iSet["coffee"],
"iced": iSet["coffee"],
"txt": iSet["document"],
"graphql": iSet["graphql"],
"gql": iSet["graphql"],
"rs": iSet["rust"],
"raml": iSet["raml"],
"xaml": iSet["xaml"],
"hs": iSet["haskell"],
"kt": iSet["kotlin"],
"kts": iSet["kotlin"],
"patch": iSet["git"],
"lua": iSet["lua"],
"clj": iSet["clojure"],
"cljs": iSet["clojure"],
"cljc": iSet["clojure"],
"groovy": iSet["groovy"],
"r": iSet["r"],
"rmd": iSet["r"],
"dart": iSet["dart"],
"as": iSet["actionscript"],
"mxml": iSet["mxml"],
"ahk": iSet["autohotkey"],
"swf": iSet["flash"],
"swc": iSet["swc"],
"cmake": iSet["cmake"],
"asm": iSet["assembly"],
"a51": iSet["assembly"],
"inc": iSet["assembly"],
"nasm": iSet["assembly"],
"s": iSet["assembly"],
"ms": iSet["assembly"],
"agc": iSet["assembly"],
"ags": iSet["assembly"],
"aea": iSet["assembly"],
"argus": iSet["assembly"],
"mitigus": iSet["assembly"],
"binsource": iSet["assembly"],
"vue": iSet["vue"],
"ml": iSet["ocaml"],
"mli": iSet["ocaml"],
"cmx": iSet["ocaml"],
"lock": iSet["lock"],
"hbs": iSet["handlebars"],
"mustache": iSet["handlebars"],
"pm": iSet["perl"],
"raku": iSet["perl"],
"hx": iSet["haxe"],
"pp": iSet["puppet"],
"ex": iSet["elixir"],
"exs": iSet["elixir"],
"eex": iSet["elixir"],
"leex": iSet["elixir"],
"erl": iSet["erlang"],
"twig": iSet["twig"],
"jl": iSet["julia"],
"elm": iSet["elm"],
"pure": iSet["purescript"],
"purs": iSet["purescript"],
"tpl": iSet["smarty"],
"styl": iSet["stylus"],
"merlin": iSet["merlin"],
"v": iSet["verilog"],
"vhd": iSet["verilog"],
"sv": iSet["verilog"],
"svh": iSet["verilog"],
"robot": iSet["robot"],
"sol": iSet["solidity"],
"yang": iSet["yang"],
"mjml": iSet["mjml"],
"tf": iSet["terraform"],
"tfvars": iSet["terraform"],
"tfstate": iSet["terraform"],
"applescript": iSet["applescript"],
"ipa": iSet["applescript"],
"cake": iSet["cake"],
"nim": iSet["nim"],
"nimble": iSet["nim"],
"apib": iSet["apiblueprint"],
"apiblueprint": iSet["apiblueprint"],
"pcss": iSet["postcss"],
"sss": iSet["postcss"],
"todo": iSet["todo"],
"nix": iSet["nix"],
"slim": iSet["slim"],
"http": iSet["http"],
"rest": iSet["http"],
"apk": iSet["android"],
"env": iSet["tune"],
"jenkinsfile": iSet["jenkins"],
"jenkins": iSet["jenkins"],
"log": iSet["log"],
"ejs": iSet["ejs"],
"djt": iSet["django"],
"pot": iSet["i18n"],
"po": iSet["i18n"],
"mo": iSet["i18n"],
"d": iSet["d"],
"mdx": iSet["mdx"],
"gd": iSet["godot"],
"godot": iSet["godot-assets"],
"tres": iSet["godot-assets"],
"tscn": iSet["godot-assets"],
"azcli": iSet["azure"],
"vagrantfile": iSet["vagrant"],
"cshtml": iSet["razor"],
"vbhtml": iSet["razor"],
"ad": iSet["asciidoc"],
"adoc": iSet["asciidoc"],
"asciidoc": iSet["asciidoc"],
"edge": iSet["edge"],
"ss": iSet["scheme"],
"scm": iSet["scheme"],
"stl": iSet["3d"],
"obj": iSet["3d"],
"ac": iSet["3d"],
"blend": iSet["3d"],
"mesh": iSet["3d"],
"mqo": iSet["3d"],
"pmd": iSet["3d"],
"pmx": iSet["3d"],
"skp": iSet["3d"],
"vac": iSet["3d"],
"vdp": iSet["3d"],
"vox": iSet["3d"],
"svg": iSet["svg"],
"vimrc": iSet["vim"],
"gvimrc": iSet["vim"],
"exrc": iSet["vim"],
"moon": iSet["moonscript"],
"iso": iSet["disc"],
"f": iSet["fortran"],
"f77": iSet["fortran"],
"f90": iSet["fortran"],
"f95": iSet["fortran"],
"f03": iSet["fortran"],
"f08": iSet["fortran"],
"tcl": iSet["tcl"],
"liquid": iSet["liquid"],
"p": iSet["prolog"],
"pro": iSet["prolog"],
"coco": iSet["coconut"],
"sketch": iSet["sketch"],
"opam": iSet["opam"],
"dhallb": iSet["dhall"],
"pwn": iSet["pawn"],
"amx": iSet["pawn"],
"dhall": iSet["dhall"],
"pas": iSet["pascal"],
"unity": iSet["shaderlab"],
"nupkg": iSet["nuget"],
"command": iSet["command"],
"dsc": iSet["denizenscript"],
// "ls": iSet["livescript"],
// "re": iSet["reason"],
// "rei": iSet["reason"],
// "cmj": iSet["bucklescript"],
// "nb": iSet["mathematica"],
// "wl": iSet["wolframlanguage"],
// "wls": iSet["wolframlanguage"],
// "njk": iSet["nunjucks"],
// "nunjucks": iSet["nunjucks"],
// "au3": iSet["autoit"],
// "haml": iSet["haml"],
// "feature": iSet["cucumber"],
// "riot": iSet["riot"],
// "tag": iSet["riot"],
// "vfl": iSet["vfl"],
// "kl": iSet["kl"],
// "cfml": iSet["coldfusion"],
// "cfc": iSet["coldfusion"],
// "lucee": iSet["coldfusion"],
// "cfm": iSet["coldfusion"],
// "cabal": iSet["cabal"],
// "rql": iSet["restql"],
// "restql": iSet["restql"],
// "kv": iSet["kivy"],
// "graphcool": iSet["graphcool"],
// "sbt": iSet["sbt"],
// "cr": iSet["crystal"],
// "ecr": iSet["crystal"],
// "cu": iSet["cuda"],
// "cuh": iSet["cuda"],
// "def": iSet["dotjs"],
// "dot": iSet["dotjs"],
// "jst": iSet["dotjs"],
// "pde": iSet["processing"],
// "wpy": iSet["wepy"],
// "hcl": iSet["hcl"],
// "san": iSet["san"],
// "red": iSet["red"],
// "fxp": iSet["foxpro"],
// "prg": iSet["foxpro"],
// "wat": iSet["webassembly"],
// "wasm": iSet["webassembly"],
// "ipynb": iSet["jupyter"],
// "bal": iSet["ballerina"],
// "balx": iSet["ballerina"],
// "rkt": iSet["racket"],
// "bzl": iSet["bazel"],
// "bazel": iSet["bazel"],
// "mint": iSet["mint"],
// "vm": iSet["velocity"],
// "fhtml": iSet["velocity"],
// "vtl": iSet["velocity"],
// "prisma": iSet["prisma"],
// "abc": iSet["abc"],
// "lisp": iSet["lisp"],
// "lsp": iSet["lisp"],
// "cl": iSet["lisp"],
// "fast": iSet["lisp"],
// "svelte": iSet["svelte"],
// "prw": iSet["advpl_prw"],
// "prx": iSet["advpl_prw"],
// "ptm": iSet["advpl_ptm"],
// "tlpp": iSet["advpl_tlpp"],
// "ch": iSet["advpl_include"],
// "4th": iSet["forth"],
// "fth": iSet["forth"],
// "frt": iSet["forth"],
// "iuml": iSet["uml"],
// "pu": iSet["uml"],
// "puml": iSet["uml"],
// "plantuml": iSet["uml"],
// "wsd": iSet["uml"],
// "sml": iSet["sml"],
// "mlton": iSet["sml"],
// "mlb": iSet["sml"],
// "sig": iSet["sml"],
// "fun": iSet["sml"],
// "cm": iSet["sml"],
// "lex": iSet["sml"],
// "use": iSet["sml"],
// "grm": iSet["sml"],
// "imba": iSet["imba"],
// "drawio": iSet["drawio"],
// "dio": iSet["drawio"],
// "sas": iSet["sas"],
// "sas7bdat": iSet["sas"],
// "sashdat": iSet["sas"],
// "astore": iSet["sas"],
// "ast": iSet["sas"],
// "sast": iSet["sas"],
}
+406
View File
@@ -0,0 +1,406 @@
package main
var Icon_FileName = map[string]*iInfo{
".pug-lintrc": iSet["pug"],
".pug-lintrc.js": iSet["pug"],
".pug-lintrc.json": iSet["pug"],
".jscsrc": iSet["json"],
".jshintrc": iSet["json"],
"composer.lock": iSet["json"],
".jsbeautifyrc": iSet["json"],
".esformatter": iSet["json"],
"cdp.pid": iSet["json"],
".mjmlconfig": iSet["json"],
".htaccess": iSet["xml"],
".jshintignore": iSet["settings"],
".buildignore": iSet["settings"],
".mrconfig": iSet["settings"],
".yardopts": iSet["settings"],
"manifest.mf": iSet["settings"],
".clang-format": iSet["settings"],
".clang-tidy": iSet["settings"],
"go.mod": iSet["go-mod"],
"go.sum": iSet["go-mod"],
"requirements.txt": iSet["python-misc"],
"pipfile": iSet["python-misc"],
".python-version": iSet["python-misc"],
"manifest.in": iSet["python-misc"],
"gradle.properties": iSet["gradle"],
"gradlew": iSet["gradle"],
"gradle-wrapper.properties": iSet["gradle"],
"license": iSet["certificate"],
"license.md": iSet["certificate"],
"license.txt": iSet["certificate"],
"licence": iSet["certificate"],
"licence.md": iSet["certificate"],
"licence.txt": iSet["certificate"],
"unlicense": iSet["certificate"],
"unlicense.md": iSet["certificate"],
"unlicense.txt": iSet["certificate"],
".htpasswd": iSet["key"],
"gemfile": iSet["gemfile"],
"dockerfile": iSet["docker"],
"dockerfile.prod": iSet["docker"],
"dockerfile.production": iSet["docker"],
"docker-compose.yml": iSet["docker"],
"docker-compose.yaml": iSet["docker"],
"docker-compose.dev.yml": iSet["docker"],
"docker-compose.local.yml": iSet["docker"],
"docker-compose.ci.yml": iSet["docker"],
"docker-compose.override.yml": iSet["docker"],
"docker-compose.staging.yml": iSet["docker"],
"docker-compose.prod.yml": iSet["docker"],
"docker-compose.production.yml": iSet["docker"],
"docker-compose.test.yml": iSet["docker"],
".mailmap": iSet["email"],
".graphqlconfig": iSet["graphql"],
".gitignore": iSet["git"],
".gitconfig": iSet["git"],
".gitattributes": iSet["git"],
".gitmodules": iSet["git"],
".gitkeep": iSet["git"],
"git-history": iSet["git"],
".luacheckrc": iSet["lua"],
".Rhistory": iSet["r"],
"cmakelists.txt": iSet["cmake"],
"cmakecache.txt": iSet["cmake"],
"vue.config.js": iSet["vue-config"],
"vue.config.ts": iSet["vue-config"],
"nuxt.config.js": iSet["nuxt"],
"nuxt.config.ts": iSet["nuxt"],
"security.md": iSet["lock"],
"security.txt": iSet["lock"],
"security": iSet["lock"],
"vercel.json": iSet["vercel"],
".vercelignore": iSet["vercel"],
"now.json": iSet["vercel"],
".nowignore": iSet["vercel"],
"postcss.config.js": iSet["postcss"],
".postcssrc.js": iSet["postcss"],
".postcssrc": iSet["postcss"],
".postcssrc.json": iSet["postcss"],
".postcssrc.yml": iSet["postcss"],
"CNAME": iSet["http"],
"webpack.js": iSet["webpack"],
"webpack.ts": iSet["webpack"],
"webpack.base.js": iSet["webpack"],
"webpack.base.ts": iSet["webpack"],
"webpack.config.js": iSet["webpack"],
"webpack.config.ts": iSet["webpack"],
"webpack.common.js": iSet["webpack"],
"webpack.common.ts": iSet["webpack"],
"webpack.config.common.js": iSet["webpack"],
"webpack.config.common.ts": iSet["webpack"],
"webpack.config.common.babel.js": iSet["webpack"],
"webpack.config.common.babel.ts": iSet["webpack"],
"webpack.dev.js": iSet["webpack"],
"webpack.dev.ts": iSet["webpack"],
"webpack.development.js": iSet["webpack"],
"webpack.development.ts": iSet["webpack"],
"webpack.config.dev.js": iSet["webpack"],
"webpack.config.dev.ts": iSet["webpack"],
"webpack.config.dev.babel.js": iSet["webpack"],
"webpack.config.dev.babel.ts": iSet["webpack"],
"webpack.prod.js": iSet["webpack"],
"webpack.prod.ts": iSet["webpack"],
"webpack.production.js": iSet["webpack"],
"webpack.production.ts": iSet["webpack"],
"webpack.server.js": iSet["webpack"],
"webpack.server.ts": iSet["webpack"],
"webpack.client.js": iSet["webpack"],
"webpack.client.ts": iSet["webpack"],
"webpack.config.server.js": iSet["webpack"],
"webpack.config.server.ts": iSet["webpack"],
"webpack.config.client.js": iSet["webpack"],
"webpack.config.client.ts": iSet["webpack"],
"webpack.config.production.babel.js": iSet["webpack"],
"webpack.config.production.babel.ts": iSet["webpack"],
"webpack.config.prod.babel.js": iSet["webpack"],
"webpack.config.prod.babel.ts": iSet["webpack"],
"webpack.config.prod.js": iSet["webpack"],
"webpack.config.prod.ts": iSet["webpack"],
"webpack.config.production.js": iSet["webpack"],
"webpack.config.production.ts": iSet["webpack"],
"webpack.config.staging.js": iSet["webpack"],
"webpack.config.staging.ts": iSet["webpack"],
"webpack.config.babel.js": iSet["webpack"],
"webpack.config.babel.ts": iSet["webpack"],
"webpack.config.base.babel.js": iSet["webpack"],
"webpack.config.base.babel.ts": iSet["webpack"],
"webpack.config.base.js": iSet["webpack"],
"webpack.config.base.ts": iSet["webpack"],
"webpack.config.staging.babel.js": iSet["webpack"],
"webpack.config.staging.babel.ts": iSet["webpack"],
"webpack.config.coffee": iSet["webpack"],
"webpack.config.test.js": iSet["webpack"],
"webpack.config.test.ts": iSet["webpack"],
"webpack.config.vendor.js": iSet["webpack"],
"webpack.config.vendor.ts": iSet["webpack"],
"webpack.config.vendor.production.js": iSet["webpack"],
"webpack.config.vendor.production.ts": iSet["webpack"],
"webpack.test.js": iSet["webpack"],
"webpack.test.ts": iSet["webpack"],
"webpack.dist.js": iSet["webpack"],
"webpack.dist.ts": iSet["webpack"],
"webpackfile.js": iSet["webpack"],
"webpackfile.ts": iSet["webpack"],
"ionic.config.json": iSet["ionic"],
".io-config.json": iSet["ionic"],
"gulpfile.js": iSet["gulp"],
"gulpfile.mjs": iSet["gulp"],
"gulpfile.ts": iSet["gulp"],
"gulpfile.babel.js": iSet["gulp"],
"package.json": iSet["nodejs"],
"package-lock.json": iSet["nodejs"],
".nvmrc": iSet["nodejs"],
".esmrc": iSet["nodejs"],
".node-version": iSet["nodejs"],
".npmignore": iSet["npm"],
".npmrc": iSet["npm"],
".yarnrc": iSet["yarn"],
"yarn.lock": iSet["yarn"],
".yarnclean": iSet["yarn"],
".yarn-integrity": iSet["yarn"],
"yarn-error.log": iSet["yarn"],
".yarnrc.yml": iSet["yarn"],
".yarnrc.yaml": iSet["yarn"],
"androidmanifest.xml": iSet["android"],
".env.defaults": iSet["tune"],
".env.example": iSet["tune"],
".env.sample": iSet["tune"],
".env.schema": iSet["tune"],
".env.local": iSet["tune"],
".env.dev": iSet["tune"],
".env.development": iSet["tune"],
".env.qa": iSet["tune"],
".env.prod": iSet["tune"],
".env.production": iSet["tune"],
".env.staging": iSet["tune"],
".env.preview": iSet["tune"],
".env.test": iSet["tune"],
".env.testing": iSet["tune"],
".env.development.local": iSet["tune"],
".env.qa.local": iSet["tune"],
".env.production.local": iSet["tune"],
".env.staging.local": iSet["tune"],
".env.test.local": iSet["tune"],
".babelrc": iSet["babel"],
".babelrc.js": iSet["babel"],
".babelrc.json": iSet["babel"],
"babel.config.json": iSet["babel"],
"babel.config.js": iSet["babel"],
"contributing.md": iSet["contributing"],
"readme.md": iSet["readme"],
"readme.txt": iSet["readme"],
"readme": iSet["readme"],
"changelog": iSet["changelog"],
"changelog.md": iSet["changelog"],
"changelog.txt": iSet["changelog"],
"changes": iSet["changelog"],
"changes.md": iSet["changelog"],
"changes.txt": iSet["changelog"],
"credits": iSet["credits"],
"credits.txt": iSet["credits"],
"credits.md": iSet["credits"],
"authors": iSet["authors"],
"authors.md": iSet["authors"],
"authors.txt": iSet["authors"],
"favicon.ico": iSet["favicon"],
"karma.conf.js": iSet["karma"],
"karma.conf.ts": iSet["karma"],
"karma.conf.coffee": iSet["karma"],
"karma.config.js": iSet["karma"],
"karma.config.ts": iSet["karma"],
"karma-main.js": iSet["karma"],
"karma-main.ts": iSet["karma"],
".travis.yml": iSet["travis"],
".codecov.yml": iSet["codecov"],
"codecov.yml": iSet["codecov"],
"protractor.conf.js": iSet["protractor"],
"protractor.conf.ts": iSet["protractor"],
"protractor.conf.coffee": iSet["protractor"],
"protractor.config.js": iSet["protractor"],
"protractor.config.ts": iSet["protractor"],
"procfile": iSet["heroku"],
"procfile.windows": iSet["heroku"],
".bowerrc": iSet["bower"],
"bower.json": iSet["bower"],
".eslintrc.js": iSet["eslint"],
".eslintrc.cjs": iSet["eslint"],
".eslintrc.yaml": iSet["eslint"],
".eslintrc.yml": iSet["eslint"],
".eslintrc.json": iSet["eslint"],
".eslintrc": iSet["eslint"],
".eslintignore": iSet["eslint"],
".eslintcache": iSet["eslint"],
"code_of_conduct.md": iSet["conduct"],
"code_of_conduct.txt": iSet["conduct"],
"mocha.opts": iSet["mocha"],
".mocharc.yml": iSet["mocha"],
".mocharc.yaml": iSet["mocha"],
".mocharc.js": iSet["mocha"],
".mocharc.json": iSet["mocha"],
".mocharc.jsonc": iSet["mocha"],
"jenkinsfile": iSet["jenkins"],
"firebase.json": iSet["firebase"],
".firebaserc": iSet["firebase"],
"firestore.rules": iSet["firebase"],
"firestore.indexes.json": iSet["firebase"],
".stylelintrc": iSet["stylelint"],
"stylelint.config.js": iSet["stylelint"],
".stylelintrc.json": iSet["stylelint"],
".stylelintrc.yaml": iSet["stylelint"],
".stylelintrc.yml": iSet["stylelint"],
".stylelintrc.js": iSet["stylelint"],
".stylelintignore": iSet["stylelint"],
".codeclimate.yml": iSet["code-climate"],
".prettierrc": iSet["prettier"],
"prettier.config.js": iSet["prettier"],
".prettierrc.js": iSet["prettier"],
".prettierrc.json": iSet["prettier"],
".prettierrc.yaml": iSet["prettier"],
".prettierrc.yml": iSet["prettier"],
".prettierignore": iSet["prettier"],
"gruntfile.js": iSet["grunt"],
"gruntfile.ts": iSet["grunt"],
"gruntfile.coffee": iSet["grunt"],
"gruntfile.babel.js": iSet["grunt"],
"gruntfile.babel.ts": iSet["grunt"],
"gruntfile.babel.coffee": iSet["grunt"],
"jest.config.js": iSet["jest"],
"jest.config.ts": iSet["jest"],
"jest.config.cjs": iSet["jest"],
"jest.config.mjs": iSet["jest"],
"jest.config.json": iSet["jest"],
"jest.e2e.config.js": iSet["jest"],
"jest.e2e.config.ts": iSet["jest"],
"jest.e2e.config.cjs": iSet["jest"],
"jest.e2e.config.mjs": iSet["jest"],
"jest.e2e.config.json": iSet["jest"],
"jest.setup.js": iSet["jest"],
"jest.setup.ts": iSet["jest"],
"jest.json": iSet["jest"],
".jestrc": iSet["jest"],
".jestrc.js": iSet["jest"],
".jestrc.json": iSet["jest"],
"jest.teardown.js": iSet["jest"],
"fastfile": iSet["fastlane"],
"appfile": iSet["fastlane"],
".helmignore": iSet["helm"],
"makefile": iSet["makefile"],
".releaserc": iSet["semantic-release"],
".releaserc.yaml": iSet["semantic-release"],
".releaserc.yml": iSet["semantic-release"],
".releaserc.json": iSet["semantic-release"],
".releaserc.js": iSet["semantic-release"],
"release.config.js": iSet["semantic-release"],
"bitbucket-pipelines.yaml": iSet["bitbucket"],
"bitbucket-pipelines.yml": iSet["bitbucket"],
"azure-pipelines.yml": iSet["azure-pipelines"],
"azure-pipelines.yaml": iSet["azure-pipelines"],
"vagrantfile": iSet["vagrant"],
"tailwind.js": iSet["tailwindcss"],
"tailwind.config.js": iSet["tailwindcss"],
"codeowners": iSet["codeowners"],
".gcloudignore": iSet["gcp"],
".huskyrc": iSet["husky"],
"husky.config.js": iSet["husky"],
".huskyrc.json": iSet["husky"],
".huskyrc.js": iSet["husky"],
".huskyrc.yaml": iSet["husky"],
".huskyrc.yml": iSet["husky"],
".commitlintrc": iSet["commitlint"],
".commitlintrc.js": iSet["commitlint"],
"commitlint.config.js": iSet["commitlint"],
".commitlintrc.json": iSet["commitlint"],
".commitlint.yaml": iSet["commitlint"],
".commitlint.yml": iSet["commitlint"],
"dune": iSet["dune"],
"dune-project": iSet["dune"],
"roadmap.md": iSet["roadmap"],
"roadmap.txt": iSet["roadmap"],
"timeline.md": iSet["roadmap"],
"timeline.txt": iSet["roadmap"],
"milestones.md": iSet["roadmap"],
"milestones.txt": iSet["roadmap"],
"nuget.config": iSet["nuget"],
".nuspec": iSet["nuget"],
"nuget.exe": iSet["nuget"],
"stryker.conf.js": iSet["stryker"],
"stryker.conf.json": iSet["stryker"],
".modernizrrc": iSet["modernizr"],
".modernizrrc.js": iSet["modernizr"],
".modernizrrc.json": iSet["modernizr"],
// ".vfl": iSet["vfl"],
// ".kl": iSet["kl"],
// "project.graphcool": iSet["graphcool"],
// ".flowconfig": iSet["flow"],
// ".bithoundrc": iSet["bithound"],
// ".appveyor.yml": iSet["appveyor"],
// "appveyor.yml": iSet["appveyor"],
// "fuse.js": iSet["fusebox"],
// ".editorconfig": iSet["editorconfig"],
// ".watchmanconfig": iSet["watchman"],
// "aurelia.json": iSet["aurelia"],
// "rollup.config.js": iSet["rollup"],
// "rollup.config.ts": iSet["rollup"],
// "rollup-config.js": iSet["rollup"],
// "rollup-config.ts": iSet["rollup"],
// "rollup.config.common.js": iSet["rollup"],
// "rollup.config.common.ts": iSet["rollup"],
// "rollup.config.base.js": iSet["rollup"],
// "rollup.config.base.ts": iSet["rollup"],
// "rollup.config.prod.js": iSet["rollup"],
// "rollup.config.prod.ts": iSet["rollup"],
// "rollup.config.dev.js": iSet["rollup"],
// "rollup.config.dev.ts": iSet["rollup"],
// "rollup.config.prod.vendor.js": iSet["rollup"],
// "rollup.config.prod.vendor.ts": iSet["rollup"],
// ".hhconfig": iSet["hack"],
// "apollo.config.js": iSet["apollo"],
// "nodemon.json": iSet["nodemon"],
// "nodemon-debug.json": iSet["nodemon"],
// ".hintrc": iSet["webhint"],
// "browserslist": iSet["browserlist"],
// ".browserslistrc": iSet["browserlist"],
// ".snyk": iSet["snyk"],
// ".drone.yml": iSet["drone"],
// ".sequelizerc": iSet["sequelize"],
// "gatsby.config.js": iSet["gatsby"],
// "gatsby-config.js": iSet["gatsby"],
// "gatsby-node.js": iSet["gatsby"],
// "gatsby-browser.js": iSet["gatsby"],
// "gatsby-ssr.js": iSet["gatsby"],
// ".wakatime-project": iSet["wakatime"],
// "circle.yml": iSet["circleci"],
// ".cfignore": iSet["cloudfoundry"],
// "wallaby.js": iSet["wallaby"],
// "wallaby.conf.js": iSet["wallaby"],
// "stencil.config.js": iSet["stencil"],
// "stencil.config.ts": iSet["stencil"],
// ".bazelignore": iSet["bazel"],
// ".bazelrc": iSet["bazel"],
// "prisma.yml": iSet["prisma"],
// ".nycrc": iSet["istanbul"],
// ".nycrc.json": iSet["istanbul"],
// "buildkite.yml": iSet["buildkite"],
// "buildkite.yaml": iSet["buildkite"],
// "netlify.json": iSet["netlify"],
// "netlify.yml": iSet["netlify"],
// "netlify.yaml": iSet["netlify"],
// "netlify.toml": iSet["netlify"],
// "nest-cli.json": iSet["nest"],
// ".nest-cli.json": iSet["nest"],
// "nestconfig.json": iSet["nest"],
// ".nestconfig.json": iSet["nest"],
// ".percy.yml": iSet["percy"],
// ".gitpod.yml": iSet["gitpod"],
// "tiltfile": iSet["tilt"],
// "capacitor.config.json": iSet["capacitor"],
// ".adonisrc.json": iSet["adonis"],
// "ace": iSet["adonis"],
// "meson.build": iSet["meson"],
// ".buckconfig": iSet["buck"],
// "nx.json": iSet["nrwl"],
// ".slugignore": iSet["slug"],
}
+328
View File
@@ -0,0 +1,328 @@
package main
import "fmt"
// iInfo (icon information)
type iInfo struct {
i string
c [3]uint8 // represents the color in rgb (default 0,0,0 is black)
}
func (i *iInfo) getGlyph() string {
return i.i
}
func (i *iInfo) getColor(f uint8) string {
if f == 1 {
return fmt.Sprintf("\033[38;2;%03d;%03d;%03dm", i.c[0], i.c[1], i.c[2])
}
return fmt.Sprintf("\033[38;2;%03d;%03d;%03dm", i.c[0], i.c[1], i.c[2])
}
var iSet = map[string]*iInfo{
"html": {"\uf13b", [3]uint8{228, 79, 57}}, // html
"markdown": {"\uf853", [3]uint8{66, 165, 245}}, // markdown
"css": {"\uf81b", [3]uint8{66, 165, 245}}, // css
"sass": {"\ue603", [3]uint8{237, 80, 122}}, // sass
"less": {"\ue60b", [3]uint8{2, 119, 189}}, // less
"json": {"\ue60b", [3]uint8{251, 193, 60}}, // json
"yaml": {"\ue60b", [3]uint8{244, 68, 62}}, // yaml
"xml": {"\uf72d", [3]uint8{64, 153, 69}}, // xml
"image": {"\uf71e", [3]uint8{48, 166, 154}}, // image
"javascript": {"\ue74e", [3]uint8{255, 202, 61}}, // javascript
"react": {"\ue7ba", [3]uint8{35, 188, 212}}, // react
"react_ts": {"\ue7ba", [3]uint8{36, 142, 211}}, // react_ts
"settings": {"\uf013", [3]uint8{66, 165, 245}}, // settings
"typescript": {"\ue628", [3]uint8{3, 136, 209}}, // typescript
"pdf": {"\uf724", [3]uint8{244, 68, 62}}, // pdf
"table": {"\uf71a", [3]uint8{139, 195, 74}}, // table
"visualstudio": {"\ue70c", [3]uint8{173, 99, 188}}, // visualstudio
"database": {"\ue706", [3]uint8{255, 202, 61}}, // database
"mysql": {"\ue704", [3]uint8{1, 94, 134}}, // mysql
"postgresql": {"\ue76e", [3]uint8{49, 99, 140}}, // postgresql
"sqlite": {"\ue7c4", [3]uint8{1, 57, 84}}, // sqlite
"csharp": {"\uf81a", [3]uint8{2, 119, 189}}, // csharp
"zip": {"\uf410", [3]uint8{175, 180, 43}}, // zip
"exe": {"\uf2d0", [3]uint8{229, 77, 58}}, // exe
"java": {"\uf675", [3]uint8{244, 68, 62}}, // java
"c": {"\ufb70", [3]uint8{2, 119, 189}}, // c
"cpp": {"\ufb71", [3]uint8{2, 119, 189}}, // cpp
"go": {"\ufcd1", [3]uint8{32, 173, 194}}, // go
"go-mod": {"\ufcd1", [3]uint8{237, 80, 122}}, // go-mod
"python": {"\uf81f", [3]uint8{52, 102, 143}}, // python
"python-misc": {"\uf820", [3]uint8{130, 61, 28}}, // python-misc
"url": {"\uf836", [3]uint8{66, 165, 245}}, // url
"console": {"\uf68c", [3]uint8{250, 111, 66}}, // console
"word": {"\uf72b", [3]uint8{1, 87, 155}}, // word
"certificate": {"\uf623", [3]uint8{249, 89, 63}}, // certificate
"key": {"\uf805", [3]uint8{48, 166, 154}}, // key
"font": {"\uf031", [3]uint8{244, 68, 62}}, // font
"lib": {"\uf831", [3]uint8{139, 195, 74}}, // lib
"ruby": {"\ue739", [3]uint8{229, 61, 58}}, // ruby
"gemfile": {"\ue21e", [3]uint8{229, 61, 58}}, // gemfile
"fsharp": {"\ue7a7", [3]uint8{55, 139, 186}}, // fsharp
"swift": {"\ufbe3", [3]uint8{249, 95, 63}}, // swift
"docker": {"\uf308", [3]uint8{1, 135, 201}}, // docker
"powerpoint": {"\uf726", [3]uint8{209, 71, 51}}, // powerpoint
"video": {"\uf72a", [3]uint8{253, 154, 62}}, // video
"virtual": {"\uf822", [3]uint8{3, 155, 229}}, // virtual
"email": {"\uf6ed", [3]uint8{66, 165, 245}}, // email
"audio": {"\ufb75", [3]uint8{239, 83, 80}}, // audio
"coffee": {"\uf675", [3]uint8{66, 165, 245}}, // coffee
"document": {"\uf718", [3]uint8{66, 165, 245}}, // document
"rust": {"\ue7a8", [3]uint8{250, 111, 66}}, // rust
"raml": {"\ue60b", [3]uint8{66, 165, 245}}, // raml
"xaml": {"\ufb72", [3]uint8{66, 165, 245}}, // xaml
"haskell": {"\ue61f", [3]uint8{254, 168, 62}}, // haskell
"git": {"\ue702", [3]uint8{229, 77, 58}}, // git
"lua": {"\ue620", [3]uint8{66, 165, 245}}, // lua
"clojure": {"\ue76a", [3]uint8{100, 221, 23}}, // clojure
"groovy": {"\uf2a6", [3]uint8{41, 198, 218}}, // groovy
"r": {"\ufcd2", [3]uint8{25, 118, 210}}, // r
"dart": {"\ue798", [3]uint8{87, 182, 240}}, // dart
"mxml": {"\uf72d", [3]uint8{254, 168, 62}}, // mxml
"assembly": {"\uf471", [3]uint8{250, 109, 63}}, // assembly
"vue": {"\ufd42", [3]uint8{65, 184, 131}}, // vue
"vue-config": {"\ufd42", [3]uint8{58, 121, 110}}, // vue-config
"lock": {"\uf83d", [3]uint8{255, 213, 79}}, // lock
"handlebars": {"\ue60f", [3]uint8{250, 111, 66}}, // handlebars
"perl": {"\ue769", [3]uint8{149, 117, 205}}, // perl
"elixir": {"\ue62d", [3]uint8{149, 117, 205}}, // elixir
"erlang": {"\ue7b1", [3]uint8{244, 68, 62}}, // erlang
"twig": {"\ue61c", [3]uint8{155, 185, 47}}, // twig
"julia": {"\ue624", [3]uint8{134, 82, 159}}, // julia
"elm": {"\ue62c", [3]uint8{96, 181, 204}}, // elm
"smarty": {"\uf834", [3]uint8{255, 207, 60}}, // smarty
"stylus": {"\ue600", [3]uint8{192, 202, 51}}, // stylus
"verilog": {"\ufb19", [3]uint8{250, 111, 66}}, // verilog
"robot": {"\ufba7", [3]uint8{249, 89, 63}}, // robot
"solidity": {"\ufcb9", [3]uint8{3, 136, 209}}, // solidity
"yang": {"\ufb7e", [3]uint8{66, 165, 245}}, // yang
"vercel": {"\uf47e", [3]uint8{207, 216, 220}}, // vercel
"applescript": {"\uf302", [3]uint8{120, 144, 156}}, // applescript
"cake": {"\uf5ea", [3]uint8{250, 111, 66}}, // cake
"nim": {"\uf6a4", [3]uint8{255, 202, 61}}, // nim
"todo": {"\uf058", [3]uint8{124, 179, 66}}, // todo
"nix": {"\uf313", [3]uint8{80, 117, 193}}, // nix
"http": {"\uf484", [3]uint8{66, 165, 245}}, // http
"webpack": {"\ufc29", [3]uint8{142, 214, 251}}, // webpack
"ionic": {"\ue7a9", [3]uint8{79, 143, 247}}, // ionic
"gulp": {"\ue763", [3]uint8{229, 61, 58}}, // gulp
"nodejs": {"\uf898", [3]uint8{139, 195, 74}}, // nodejs
"npm": {"\ue71e", [3]uint8{203, 56, 55}}, // npm
"yarn": {"\uf61a", [3]uint8{44, 142, 187}}, // yarn
"android": {"\uf531", [3]uint8{139, 195, 74}}, // android
"tune": {"\ufb69", [3]uint8{251, 193, 60}}, // tune
"contributing": {"\uf64d", [3]uint8{255, 202, 61}}, // contributing
"readme": {"\uf7fb", [3]uint8{66, 165, 245}}, // readme
"changelog": {"\ufba6", [3]uint8{139, 195, 74}}, // changelog
"credits": {"\uf75f", [3]uint8{156, 204, 101}}, // credits
"authors": {"\uf0c0", [3]uint8{244, 68, 62}}, // authors
"favicon": {"\ue623", [3]uint8{255, 213, 79}}, // favicon
"karma": {"\ue622", [3]uint8{60, 190, 174}}, // karma
"travis": {"\ue77e", [3]uint8{203, 58, 73}}, // travis
"heroku": {"\ue607", [3]uint8{105, 99, 185}}, // heroku
"gitlab": {"\uf296", [3]uint8{226, 69, 57}}, // gitlab
"bower": {"\ue61a", [3]uint8{239, 88, 60}}, // bower
"conduct": {"\uf64b", [3]uint8{205, 220, 57}}, // conduct
"jenkins": {"\ue767", [3]uint8{240, 214, 183}}, // jenkins
"code-climate": {"\uf7f4", [3]uint8{238, 238, 238}}, // code-climate
"log": {"\uf719", [3]uint8{175, 180, 43}}, // log
"ejs": {"\ue618", [3]uint8{255, 202, 61}}, // ejs
"grunt": {"\ue611", [3]uint8{251, 170, 61}}, // grunt
"django": {"\ue71d", [3]uint8{67, 160, 71}}, // django
"makefile": {"\uf728", [3]uint8{239, 83, 80}}, // makefile
"bitbucket": {"\uf171", [3]uint8{31, 136, 229}}, // bitbucket
"d": {"\ue7af", [3]uint8{244, 68, 62}}, // d
"mdx": {"\uf853", [3]uint8{255, 202, 61}}, // mdx
"azure-pipelines": {"\uf427", [3]uint8{20, 101, 192}}, // azure-pipelines
"azure": {"\ufd03", [3]uint8{31, 136, 229}}, // azure
"razor": {"\uf564", [3]uint8{66, 165, 245}}, // razor
"asciidoc": {"\uf718", [3]uint8{244, 68, 62}}, // asciidoc
"edge": {"\uf564", [3]uint8{239, 111, 60}}, // edge
"scheme": {"\ufb26", [3]uint8{244, 68, 62}}, // scheme
"3d": {"\ue79b", [3]uint8{40, 182, 246}}, // 3d
"svg": {"\ufc1f", [3]uint8{255, 181, 62}}, // svg
"vim": {"\ue62b", [3]uint8{67, 160, 71}}, // vim
"moonscript": {"\uf186", [3]uint8{251, 193, 60}}, // moonscript
"codeowners": {"\uf507", [3]uint8{175, 180, 43}}, // codeowners
"disc": {"\ue271", [3]uint8{176, 190, 197}}, // disc
"fortran": {"F", [3]uint8{250, 111, 66}}, // fortran
"tcl": {"\ufbd1", [3]uint8{239, 83, 80}}, // tcl
"liquid": {"\ue275", [3]uint8{40, 182, 246}}, // liquid
"prolog": {"\ue7a1", [3]uint8{239, 83, 80}}, // prolog
"husky": {"\uf8e8", [3]uint8{229, 229, 229}}, // husky
"coconut": {"\uf5d2", [3]uint8{141, 110, 99}}, // coconut
"sketch": {"\uf6c7", [3]uint8{255, 194, 61}}, // sketch
"pawn": {"\ue261", [3]uint8{239, 111, 60}}, // pawn
"commitlint": {"\ufc16", [3]uint8{43, 150, 137}}, // commitlint
"dhall": {"\uf448", [3]uint8{120, 144, 156}}, // dhall
"dune": {"\uf7f4", [3]uint8{244, 127, 61}}, // dune
"shaderlab": {"\ufbad", [3]uint8{25, 118, 210}}, // shaderlab
"command": {"\ufb32", [3]uint8{175, 188, 194}}, // command
"stryker": {"\uf05b", [3]uint8{239, 83, 80}}, // stryker
"modernizr": {"\ue720", [3]uint8{234, 72, 99}}, // modernizr
"roadmap": {"\ufb6d", [3]uint8{48, 166, 154}}, // roadmap
"pug": {"\ue60e", [3]uint8{239, 204, 163}}, // pug (Not supported by nerdFont)
"blink": {"\uf72a", [3]uint8{249, 169, 60}}, // blink (The Foundry Nuke) (Not supported by nerdFont)
"postcss": {"\uf81b", [3]uint8{244, 68, 62}}, // postcss (Not supported by nerdFont)
"jinja": {"\ue000", [3]uint8{174, 44, 42}}, // jinja (Not supported by nerdFont)
"sublime": {"\ue7aa", [3]uint8{239, 148, 58}}, // sublime (Not supported by nerdFont)
"markojs": {"\uf13b", [3]uint8{2, 119, 189}}, // markojs (Not supported by nerdFont)
"vscode": {"\ue70c", [3]uint8{33, 150, 243}}, // vscode (Not supported by nerdFont)
"qsharp": {"\uf292", [3]uint8{251, 193, 60}}, // qsharp (Not supported by nerdFont)
"vala": {"\uf7ab", [3]uint8{149, 117, 205}}, // vala (Not supported by nerdFont)
"zig": {"Z", [3]uint8{249, 169, 60}}, // zig (Not supported by nerdFont)
"h": {"h", [3]uint8{2, 119, 189}}, // h (Not supported by nerdFont)
"hpp": {"h", [3]uint8{2, 119, 189}}, // hpp (Not supported by nerdFont)
"powershell": {"\ufcb5", [3]uint8{5, 169, 244}}, // powershell (Not supported by nerdFont)
"gradle": {"\ufcc4", [3]uint8{29, 151, 167}}, // gradle (Not supported by nerdFont)
"arduino": {"\ue255", [3]uint8{35, 151, 156}}, // arduino (Not supported by nerdFont)
"tex": {"\uf783", [3]uint8{66, 165, 245}}, // tex (Not supported by nerdFont)
"graphql": {"\ue284", [3]uint8{237, 80, 122}}, // graphql (Not supported by nerdFont)
"kotlin": {"\ue70e", [3]uint8{139, 195, 74}}, // kotlin (Not supported by nerdFont)
"actionscript": {"\ufb25", [3]uint8{244, 68, 62}}, // actionscript (Not supported by nerdFont)
"autohotkey": {"\uf812", [3]uint8{76, 175, 80}}, // autohotkey (Not supported by nerdFont)
"flash": {"\uf740", [3]uint8{198, 52, 54}}, // flash (Not supported by nerdFont)
"swc": {"\ufbd3", [3]uint8{198, 52, 54}}, // swc (Not supported by nerdFont)
"cmake": {"\uf425", [3]uint8{178, 178, 179}}, // cmake (Not supported by nerdFont)
"nuxt": {"\ue2a6", [3]uint8{65, 184, 131}}, // nuxt (Not supported by nerdFont)
"ocaml": {"\uf1ce", [3]uint8{253, 154, 62}}, // ocaml (Not supported by nerdFont)
"haxe": {"\uf425", [3]uint8{246, 137, 61}}, // haxe (Not supported by nerdFont)
"puppet": {"\uf595", [3]uint8{251, 193, 60}}, // puppet (Not supported by nerdFont)
"purescript": {"\uf670", [3]uint8{66, 165, 245}}, // purescript (Not supported by nerdFont)
"merlin": {"\uf136", [3]uint8{66, 165, 245}}, // merlin (Not supported by nerdFont)
"mjml": {"\ue714", [3]uint8{249, 89, 63}}, // mjml (Not supported by nerdFont)
"terraform": {"\ue20f", [3]uint8{92, 107, 192}}, // terraform (Not supported by nerdFont)
"apiblueprint": {"\uf031", [3]uint8{66, 165, 245}}, // apiblueprint (Not supported by nerdFont)
"slim": {"\uf24e", [3]uint8{245, 129, 61}}, // slim (Not supported by nerdFont)
"babel": {"\uf5a0", [3]uint8{253, 217, 59}}, // babel (Not supported by nerdFont)
"codecov": {"\ue37c", [3]uint8{237, 80, 122}}, // codecov (Not supported by nerdFont)
"protractor": {"\uf288", [3]uint8{229, 61, 58}}, // protractor (Not supported by nerdFont)
"eslint": {"\ufbf6", [3]uint8{121, 134, 203}}, // eslint (Not supported by nerdFont)
"mocha": {"\uf6a9", [3]uint8{161, 136, 127}}, // mocha (Not supported by nerdFont)
"firebase": {"\ue787", [3]uint8{251, 193, 60}}, // firebase (Not supported by nerdFont)
"stylelint": {"\ufb76", [3]uint8{207, 216, 220}}, // stylelint (Not supported by nerdFont)
"prettier": {"\uf8e2", [3]uint8{86, 179, 180}}, // prettier (Not supported by nerdFont)
"jest": {"J", [3]uint8{244, 85, 62}}, // jest (Not supported by nerdFont)
"storybook": {"\ufd2c", [3]uint8{237, 80, 122}}, // storybook (Not supported by nerdFont)
"fastlane": {"\ufbff", [3]uint8{149, 119, 232}}, // fastlane (Not supported by nerdFont)
"helm": {"\ufd31", [3]uint8{32, 173, 194}}, // helm (Not supported by nerdFont)
"i18n": {"\uf7be", [3]uint8{121, 134, 203}}, // i18n (Not supported by nerdFont)
"semantic-release": {"\uf70f", [3]uint8{245, 245, 245}}, // semantic-release (Not supported by nerdFont)
"godot": {"\ufba7", [3]uint8{79, 195, 247}}, // godot (Not supported by nerdFont)
"godot-assets": {"\ufba7", [3]uint8{129, 199, 132}}, // godot-assets (Not supported by nerdFont)
"vagrant": {"\uf27d", [3]uint8{20, 101, 192}}, // vagrant (Not supported by nerdFont)
"tailwindcss": {"\ufc8b", [3]uint8{77, 182, 172}}, // tailwindcss (Not supported by nerdFont)
"gcp": {"\uf662", [3]uint8{70, 136, 250}}, // gcp (Not supported by nerdFont)
"opam": {"\uf1ce", [3]uint8{255, 213, 79}}, // opam (Not supported by nerdFont)
"pascal": {"\uf8da", [3]uint8{3, 136, 209}}, // pascal (Not supported by nerdFont)
"nuget": {"\ue77f", [3]uint8{3, 136, 209}}, // nuget (Not supported by nerdFont)
"denizenscript": {"D", [3]uint8{255, 213, 79}}, // denizenscript (Not supported by nerdFont)
// "riot": {"\u", [3]uint8{255, 255, 255}}, // riot
// "autoit": {"\u", [3]uint8{255, 255, 255}}, // autoit
// "livescript": {"\u", [3]uint8{255, 255, 255}}, // livescript
// "reason": {"\u", [3]uint8{255, 255, 255}}, // reason
// "bucklescript": {"\u", [3]uint8{255, 255, 255}}, // bucklescript
// "mathematica": {"\u", [3]uint8{255, 255, 255}}, // mathematica
// "wolframlanguage": {"\u", [3]uint8{255, 255, 255}}, // wolframlanguage
// "nunjucks": {"\u", [3]uint8{255, 255, 255}}, // nunjucks
// "haml": {"\u", [3]uint8{255, 255, 255}}, // haml
// "cucumber": {"\u", [3]uint8{255, 255, 255}}, // cucumber
// "vfl": {"\u", [3]uint8{255, 255, 255}}, // vfl
// "kl": {"\u", [3]uint8{255, 255, 255}}, // kl
// "coldfusion": {"\u", [3]uint8{255, 255, 255}}, // coldfusion
// "cabal": {"\u", [3]uint8{255, 255, 255}}, // cabal
// "restql": {"\u", [3]uint8{255, 255, 255}}, // restql
// "kivy": {"\u", [3]uint8{255, 255, 255}}, // kivy
// "graphcool": {"\u", [3]uint8{255, 255, 255}}, // graphcool
// "sbt": {"\u", [3]uint8{255, 255, 255}}, // sbt
// "flow": {"\u", [3]uint8{255, 255, 255}}, // flow
// "bithound": {"\u", [3]uint8{255, 255, 255}}, // bithound
// "appveyor": {"\u", [3]uint8{255, 255, 255}}, // appveyor
// "fusebox": {"\u", [3]uint8{255, 255, 255}}, // fusebox
// "editorconfig": {"\u", [3]uint8{255, 255, 255}}, // editorconfig
// "watchman": {"\u", [3]uint8{255, 255, 255}}, // watchman
// "aurelia": {"\u", [3]uint8{255, 255, 255}}, // aurelia
// "rollup": {"\u", [3]uint8{255, 255, 255}}, // rollup
// "hack": {"\u", [3]uint8{255, 255, 255}}, // hack
// "apollo": {"\u", [3]uint8{255, 255, 255}}, // apollo
// "nodemon": {"\u", [3]uint8{255, 255, 255}}, // nodemon
// "webhint": {"\u", [3]uint8{255, 255, 255}}, // webhint
// "browserlist": {"\u", [3]uint8{255, 255, 255}}, // browserlist
// "crystal": {"\u", [3]uint8{255, 255, 255}}, // crystal
// "snyk": {"\u", [3]uint8{255, 255, 255}}, // snyk
// "drone": {"\u", [3]uint8{255, 255, 255}}, // drone
// "cuda": {"\u", [3]uint8{255, 255, 255}}, // cuda
// "dotjs": {"\u", [3]uint8{255, 255, 255}}, // dotjs
// "sequelize": {"\u", [3]uint8{255, 255, 255}}, // sequelize
// "gatsby": {"\u", [3]uint8{255, 255, 255}}, // gatsby
// "wakatime": {"\u", [3]uint8{255, 255, 255}}, // wakatime
// "circleci": {"\u", [3]uint8{255, 255, 255}}, // circleci
// "cloudfoundry": {"\u", [3]uint8{255, 255, 255}}, // cloudfoundry
// "processing": {"\u", [3]uint8{255, 255, 255}}, // processing
// "wepy": {"\u", [3]uint8{255, 255, 255}}, // wepy
// "hcl": {"\u", [3]uint8{255, 255, 255}}, // hcl
// "san": {"\u", [3]uint8{255, 255, 255}}, // san
// "wallaby": {"\u", [3]uint8{255, 255, 255}}, // wallaby
// "stencil": {"\u", [3]uint8{255, 255, 255}}, // stencil
// "red": {"\u", [3]uint8{255, 255, 255}}, // red
// "webassembly": {"\u", [3]uint8{255, 255, 255}}, // webassembly
// "foxpro": {"\u", [3]uint8{255, 255, 255}}, // foxpro
// "jupyter": {"\u", [3]uint8{255, 255, 255}}, // jupyter
// "ballerina": {"\u", [3]uint8{255, 255, 255}}, // ballerina
// "racket": {"\u", [3]uint8{255, 255, 255}}, // racket
// "bazel": {"\u", [3]uint8{255, 255, 255}}, // bazel
// "mint": {"\u", [3]uint8{255, 255, 255}}, // mint
// "velocity": {"\u", [3]uint8{255, 255, 255}}, // velocity
// "prisma": {"\u", [3]uint8{255, 255, 255}}, // prisma
// "abc": {"\u", [3]uint8{255, 255, 255}}, // abc
// "istanbul": {"\u", [3]uint8{255, 255, 255}}, // istanbul
// "lisp": {"\u", [3]uint8{255, 255, 255}}, // lisp
// "buildkite": {"\u", [3]uint8{255, 255, 255}}, // buildkite
// "netlify": {"\u", [3]uint8{255, 255, 255}}, // netlify
// "svelte": {"\u", [3]uint8{255, 255, 255}}, // svelte
// "nest": {"\u", [3]uint8{255, 255, 255}}, // nest
// "percy": {"\u", [3]uint8{255, 255, 255}}, // percy
// "gitpod": {"\u", [3]uint8{255, 255, 255}}, // gitpod
// "advpl_prw": {"\u", [3]uint8{255, 255, 255}}, // advpl_prw
// "advpl_ptm": {"\u", [3]uint8{255, 255, 255}}, // advpl_ptm
// "advpl_tlpp": {"\u", [3]uint8{255, 255, 255}}, // advpl_tlpp
// "advpl_include": {"\u", [3]uint8{255, 255, 255}}, // advpl_include
// "tilt": {"\u", [3]uint8{255, 255, 255}}, // tilt
// "capacitor": {"\u", [3]uint8{255, 255, 255}}, // capacitor
// "adonis": {"\u", [3]uint8{255, 255, 255}}, // adonis
// "forth": {"\u", [3]uint8{255, 255, 255}}, // forth
// "uml": {"\u", [3]uint8{255, 255, 255}}, // uml
// "meson": {"\u", [3]uint8{255, 255, 255}}, // meson
// "buck": {"\u", [3]uint8{255, 255, 255}}, // buck
// "sml": {"\u", [3]uint8{255, 255, 255}}, // sml
// "nrwl": {"\u", [3]uint8{255, 255, 255}}, // nrwl
// "imba": {"\u", [3]uint8{255, 255, 255}}, // imba
// "drawio": {"\u", [3]uint8{255, 255, 255}}, // drawio
// "sas": {"\u", [3]uint8{255, 255, 255}}, // sas
// "slug": {"\u", [3]uint8{255, 255, 255}}, // slug
"dir-config": {"\ue5fc", [3]uint8{32, 173, 194}}, // dir-config
"dir-controller": {"\ue5fc", [3]uint8{255, 194, 61}}, // dir-controller
"dir-git": {"\ue5fb", [3]uint8{250, 111, 66}}, // dir-git
"dir-github": {"\ue5fd", [3]uint8{84, 110, 122}}, // dir-github
"dir-npm": {"\ue5fa", [3]uint8{203, 56, 55}}, // dir-npm
"dir-include": {"\uf756", [3]uint8{3, 155, 229}}, // dir-include
"dir-import": {"\uf756", [3]uint8{175, 180, 43}}, // dir-import
"dir-upload": {"\uf758", [3]uint8{250, 111, 66}}, // dir-upload
"dir-download": {"\uf74c", [3]uint8{76, 175, 80}}, // dir-download
"dir-secure": {"\uf74f", [3]uint8{249, 169, 60}}, // dir-secure
"dir-images": {"\uf74e", [3]uint8{43, 150, 137}}, // dir-images
"dir-environment": {"\uf74e", [3]uint8{102, 187, 106}}, // dir-environment
}
// default icons in case nothing can be found
var iDef = map[string]*iInfo{
"dir": {"\uf74a", [3]uint8{224, 177, 77}},
"diropen": {"\ufc6e", [3]uint8{224, 177, 77}},
"hiddendir": {"\uf755", [3]uint8{224, 177, 77}},
"exe": {"\uf713", [3]uint8{76, 175, 80}},
"file": {"\uf723", [3]uint8{65, 129, 190}},
"hiddenfile": {"\ufb12", [3]uint8{65, 129, 190}},
}
+94
View File
@@ -0,0 +1,94 @@
package main
import (
"bytes"
"fmt"
"io"
"log"
"os"
"sort"
"testing"
"github.com/Yash-Handa/logo-ls/ctw"
"golang.org/x/crypto/ssh/terminal"
)
func TestFileIcons(t *testing.T) {
log.Println("Printing each supported file name and ext by the icon pack")
// get terminal width
var e error = nil
terminalWidth, _, e = terminal.GetSize(int(os.Stdout.Fd()))
if e != nil {
terminalWidth = 80
}
ks := make([]string, 0)
for k := range iSet {
ks = append(ks, k)
}
sort.Strings(ks)
for _, v := range ks {
t.Run("Testing icon: "+v, func(st *testing.T) {
i := iSet[v]
fmt.Fprintln(os.Stderr)
buf := bytes.NewBuffer([]byte(""))
log.Println("Printing files of type", i.getColor(1)+v+"\033[38;2;255;255;255m")
w := ctw.New(terminalWidth)
for f, d := range Icon_FileName {
if d == i {
w.AddRow(" ", d.getGlyph(), f, "")
w.IconColor(d.getColor(1))
}
}
w.Flush(buf)
io.Copy(os.Stderr, buf)
buf = bytes.NewBuffer([]byte(""))
log.Println("Printing extentions of type", i.getColor(1)+v+"\033[38;2;255;255;255m")
w = ctw.New(terminalWidth)
for e, d := range Icon_Ext {
if d == i {
w.AddRow(" ", d.getGlyph(), e, "")
w.IconColor(d.getColor(1))
}
}
w.Flush(buf)
io.Copy(os.Stderr, buf)
})
}
}
func TestIconDisplay(t *testing.T) {
// get terminal width
var e error = nil
terminalWidth, _, e = terminal.GetSize(int(os.Stdout.Fd()))
if e != nil {
terminalWidth = 80
}
temp := [2]map[string]*iInfo{iSet, iDef}
for i, set := range temp {
t.Run(fmt.Sprintf("Icon Set %d", i+1), func(st *testing.T) {
//sorting alphabetically
ks := make([]string, 0)
for k := range set {
ks = append(ks, k)
}
sort.Strings(ks)
// display icons
buf := bytes.NewBuffer([]byte("\n"))
w := ctw.New(terminalWidth)
for _, v := range ks {
w.AddRow(" ", set[v].getGlyph(), v, "")
w.IconColor(set[v].getColor(1))
}
w.Flush(buf)
io.Copy(os.Stdout, buf)
fmt.Fprintln(os.Stdout)
})
}
}
BIN
View File
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
[ENVIRONMENT]
For correct display of icons the terminal should support UTF-8 encoding
with NERD FONT <https://github.com/ryanoasis/nerd-fonts> patched font.
For correct display of colors the terminal should support TRUE COLOR.
[REPORTING BUGS]
Report Bugs to <https://github.com/Yash-Handa/logo-ls/issues>
[SEE ALSO]
Full documentation with examples at: <https://www.github.com/Yash-Handa/logo-ls>
+197 -21
View File
@@ -5,8 +5,12 @@ import (
"io"
"log"
"os"
"sort"
"time"
"github.com/Yash-Handa/logo-ls/ctw"
"github.com/pborman/getopt/v2"
"golang.org/x/crypto/ssh/terminal"
)
// flags with corresponding bit values
@@ -16,8 +20,12 @@ const (
flag_l uint = 1 << iota
flag_a
flag_alpha // sort in alphabetic order (default)
flag_i // stop printing of icons
flag_c // stop printing of colors
flag_D // stop printing of git status
flag_A
flag_h
flag_R
flag_r
flag_S
flag_t
@@ -35,11 +43,44 @@ const (
// flagVector has all the options set in it. Each bit represent an option.
var flagVector uint
// terminal width for formatting
var terminalWidth int
// time formate
var timeFormate string
const (
code_OK int = iota
code_Minor
code_Serious
)
// os exit code (do not update manually)
var osExitCode int = code_OK
// only use set_osExitCode to update the value of osExitCode
func set_osExitCode(c int) int {
switch {
case c == code_Serious:
osExitCode = code_Serious
case c == code_Minor && osExitCode != code_Serious:
osExitCode = code_Minor
}
return osExitCode
}
var openDir = iDef["diropen"].getColor(1) + iDef["diropen"].getGlyph() + "\033[38;2;255;255;255m" + " "
func main() {
// content flags
f_a := getopt.BoolLong("all", 'a', "do not ignore entries starting with .")
f_A := getopt.BoolLong("almost-all", 'A', "do not list implied . and ..")
// disable Stuff
f_D := getopt.BoolLong("git-status", 'D', "print git status of files")
f_c := getopt.BoolLong("disable-color", 'c', "don't color icons, filenames and git status (use this to print to a file)")
f_i := getopt.BoolLong("disable-icon", 'i', "don't print icons of the files")
// display flags
f_1 := getopt.Bool('1', "list one file per line.")
f_d := getopt.BoolLong("directory", 'd', "list directories themselves, not their contents")
@@ -58,8 +99,10 @@ func main() {
f_t := getopt.Bool('t', "sort by modification time, newest first")
f_r := getopt.BoolLong("reverse", 'r', "reverse order while sorting")
f_R := getopt.BoolLong("recursive", 'R', "list subdirectories recursively")
f_T := getopt.EnumLong("time-style", 'T', []string{"Stamp", "StampMilli", "Kitchen", "ANSIC", "UnixDate", "RubyDate", "RFC1123", "RFC1123Z", "RFC3339", "RFC822", "RFC822Z", "RFC850"}, "Stamp", "time/date format with -l; see time-style below")
f_help := getopt.Bool('?', "display this help and exit")
f_help := getopt.BoolLong("help", '?', "display this help and exit")
f_V := getopt.BoolLong("version", 'V', "output version information and exit")
// using getopt.Getopt instead of parse to provide custom err
@@ -67,19 +110,41 @@ func main() {
if err != nil {
// code to handle error
log.Printf("%v\nTry 'logo-ls -?' for more information.", err)
os.Exit(2)
os.Exit(set_osExitCode(code_Serious))
}
// if f_help is provided print help and exit(0)
if *f_help {
fmt.Println("List information about the FILEs with ICONS and GIT STATUS (the current dir \nby default). Sort entries alphabetically if none of -tvSUX is specified.")
getopt.PrintUsage(os.Stdout)
os.Exit(0)
fmt.Println("\nPossible value for --time-style (-T)")
fmt.Printf(" %-11s %-32q\n", "ANSIC", "Mon Jan _2 15:04:05 2006")
fmt.Printf(" %-11s %-32q\n", "UnixDate", "Mon Jan _2 15:04:05 MST 2006")
fmt.Printf(" %-11s %-32q\n", "RubyDate", "Mon Jan 02 15:04:05 -0700 2006")
fmt.Printf(" %-11s %-32q\n", "RFC822", "02 Jan 06 15:04 MST")
fmt.Printf(" %-11s %-32q\n", "RFC822Z", "02 Jan 06 15:04 -0700")
fmt.Printf(" %-11s %-32q\n", "RFC850", "Monday, 02-Jan-06 15:04:05 MST")
fmt.Printf(" %-11s %-32q\n", "RFC1123", "Mon, 02 Jan 2006 15:04:05 MST")
fmt.Printf(" %-11s %-32q\n", "RFC1123Z", "Mon, 02 Jan 2006 15:04:05 -0700")
fmt.Printf(" %-11s %-32q\n", "RFC3339", "2006-01-02T15:04:05Z07:00")
fmt.Printf(" %-11s %-32q\n", "Kitchen", "3:04PM")
fmt.Printf(" %-11s %-32q [Default]\n", "Stamp", "Mon Jan _2 15:04:05")
fmt.Printf(" %-11s %-32q\n", "StampMilli", "Jan _2 15:04:05.000")
fmt.Println("\nExit status:")
fmt.Println(" 0 if OK,")
fmt.Println(" 1 if minor problems (e.g., cannot access subdirectory),")
fmt.Println(" 2 if serious trouble (e.g., cannot access command-line argument).")
os.Exit(osExitCode)
}
// if f_V is provided version will be printed and exit(0)
if *f_V {
fmt.Printf("logo-ls %s\nCopyright (c) 2020 Yash Handa\nLicense MIT <https://opensource.org/licenses/MIT>.\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n", "v0.0.0")
os.Exit(0)
fmt.Printf("logo-ls %s\nCopyright (c) 2020 Yash Handa\nLicense MIT <https://opensource.org/licenses/MIT>.\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n", "v1.3.0")
fmt.Println("\nWritten by Yash Handa")
os.Exit(osExitCode)
}
// set one of -A and -a priority -A > -a
@@ -111,6 +176,30 @@ func main() {
flagVector |= flag_r
}
// set recursion (-R) flag
if *f_R {
flagVector |= flag_R
}
// set disable-git-status (-D) flag
if *f_D {
flagVector |= flag_D
}
// set disable-color (-c) flag
if *f_c {
flagVector |= flag_c
ctw.DisplayColor(false)
openDir = iDef["diropen"].getGlyph() + " "
}
// set disable-icon (-i) flag
if *f_i {
flagVector |= flag_i
openDir = ""
ctw.DisplayBrailEmpty(false)
}
// set -1 flag
if *f_1 {
flagVector |= flag_1
@@ -126,6 +215,36 @@ func main() {
flagVector |= flag_G
}
// set time formate
switch *f_T {
case "Stamp":
timeFormate = time.Stamp
case "StampMilli":
timeFormate = time.StampMilli
case "Kitchen":
timeFormate = time.Kitchen
case "ANSIC":
timeFormate = time.ANSIC
case "UnixDate":
timeFormate = time.UnixDate
case "RubyDate":
timeFormate = time.RubyDate
case "RFC1123":
timeFormate = time.RFC1123
case "RFC1123Z":
timeFormate = time.RFC1123Z
case "RFC3339":
timeFormate = time.RFC3339
case "RFC822":
timeFormate = time.RFC822
case "RFC822Z":
timeFormate = time.RFC822Z
case "RFC850":
timeFormate = time.RFC850
default:
timeFormate = time.Stamp
}
// set -h flag
if *f_h {
flagVector |= flag_h
@@ -144,32 +263,91 @@ func main() {
flagVector |= flag_g
case *f_l:
flagVector |= flag_l
case *f_1:
default:
// screen width for custom tw
var e error = nil
terminalWidth, _, e = terminal.GetSize(int(os.Stdout.Fd()))
if e != nil {
terminalWidth = 80
}
}
// extract files/dir from arguments
dirs := getopt.Args()
if len(dirs) == 0 {
// use pwd
pwd, err := os.Open(".")
dirs = append(dirs, ".")
}
sort.Strings(dirs)
args := struct {
files []os.FileInfo
dirs []*os.File
}{}
// segregate args in files and dirs, and print error for those which cannot be opened
for _, v := range dirs {
d, err := os.Open(v)
if err != nil {
log.Printf("cannot access \".\": %v\n", err)
pwd.Close()
os.Exit(2)
log.Printf("cannot access %q: %v\n", v, err)
d.Close()
_ = set_osExitCode(code_Serious)
continue
}
d, err := newDir(pwd)
pwd.Close()
ds, err := d.Stat()
if err != nil {
log.Printf("partial access to \".\": %v\n", err)
defer os.Exit(2)
log.Printf("cannot access %q: %v\n", v, err)
d.Close()
_ = set_osExitCode(code_Serious)
continue
}
// print the info of the files of pwd
io.Copy(os.Stdout, d.print())
} else {
for _, v := range dirs {
// use this list containing both dirs and files
_ = v
if ds.IsDir() {
args.dirs = append(args.dirs, d)
} else {
args.files = append(args.files, ds)
}
}
// process and display all files
if len(args.files) > 0 {
io.Copy(os.Stdout, newDir_ArgFiles(args.files).print())
if len(args.dirs) > 0 {
fmt.Println()
}
}
// process and display all the dirs in arg
if flagVector&flag_R > 0 {
// use recursive func
for i, v := range args.dirs {
if i > 0 {
fmt.Println()
}
fmt.Printf("%s:\n", openDir+v.Name())
newDirs_Recussion(v)
}
} else {
pName := len(dirs) > 1
for i, v := range args.dirs {
if pName {
fmt.Printf("%s:\n", openDir+v.Name())
}
d, err := newDir(v)
v.Close()
if err != nil {
log.Printf("partial access to %q: %v\n", v.Name(), err)
_ = set_osExitCode(code_Serious)
}
// print the info of the files of the directory
io.Copy(os.Stdout, d.print())
if i < len(args.dirs)-1 {
fmt.Println()
}
}
}
os.Exit(osExitCode)
}
func init() {
@@ -177,5 +355,3 @@ func init() {
log.SetPrefix("logo-ls: ")
log.SetFlags(0)
}
// todo: i. multiple dir/ file handle