74 Commits
Author SHA1 Message Date
Yash-Handa e9103c7b9f bumped up version to 1.3.7 2021-01-19 14:46:25 +05:30
Yash Handa a63c74a66b fixed windows os display 2021-01-19 14:03:52 +05:30
Yash-Handa 2492038848 optamization of -D (git status) command 2020-12-29 12:24:40 +05:30
Yash-Handa 50b0a296ec Updated snapshort for change from white to noColor 2020-12-28 20:46:20 +05:30
Yash HandaandGitHub f05b146afe Merge pull request #17 from Ortiye/master
Fix colors
2020-12-28 19:19:50 +05:30
Yash HandaandGitHub 77afdeb394 removed reference of white 2020-12-28 19:15:07 +05:30
Yash-Handa c32decf6d5 Go build passing 2020-12-28 19:08:42 +05:30
Yash-Handa 8495741d5f Made recursion alphabetic for re-producability 2020-12-28 19:06:25 +05:30
Yash HandaandGitHub 24436936f0 Create go.yml 2020-12-28 18:40:49 +05:30
Yash-Handa 81e700ab5d Added end to end tests for commands 2020-12-28 18:36:43 +05:30
Yash HandaandGitHub 9972f5644a Merge pull request #18 from komem3/shellwidth
Supported for terminals that do not support 'TIOCGWINSZ'
2020-11-01 18:15:49 +05:30
Yash-Handa c6c7cf7b1f Added support for sub-extentions for files.
The list of sub-extentions added are :
routing.ts, routing.tsx, routing.js, routing.jsx, routes.ts, routes.tsx, routes.js, routes.jsx, sln.dotsettings, d.ts, vcxitems.filters, vcxproj.filters, js.map, mjs.map, css.map, spec.ts, e2e-spec.ts, test.ts, ts.snap, spec.tsx, test.tsx, tsx.snap, spec.jsx, test.jsx, jsx.snap, spec.js, e2e-spec.js, test.js, js.snap, tf.json, blade.php, inky.php, gitlab-ci.yml, stories.js, stories.jsx, story.js, story.jsx, stories.ts, stories.tsx, story.ts, story.tsx, azure-pipelines.yml, azure-pipelines.yaml
2020-11-01 17:38:01 +05:30
Yash HandaandGitHub 483c3a3060 Merge pull request #6 from mattn/windows
Support Windows
2020-11-01 06:34:29 +05:30
Yash HandaandGitHub 9542954447 Merge pull request #14 from EugeneChung/patch-1
change Mac OS man page
2020-11-01 05:57:57 +05:30
Yasuhiro Matsumoto bd000027bf Merge branch 'master' into windows 2020-10-05 23:46:45 +09:00
komem3 023e18fcb3 Supported for terminals that do not support 'TIOCGWINSZ'
Not all terminals can use 'TIOCGWINSZ' to get the size of the terminal.
That's why I used the "COLUMNS" variable to get the size when the width is zero.
2020-10-01 19:46:39 +09:00
Ortiye e0da5f56f6 fix colors 2020-09-30 22:07:27 +02:00
Eugene ChungandGitHub f43afd530a change Mac OS man page
to /usr/local/share/man/man1/

sudo cp logo-ls.1.gz /usr/share/man/man1/
cp: /usr/share/man/man1/logo-ls.1.gz: Read-only file system
(On Catalina 10.15.7)
2020-09-30 14:11:48 +09:00
Yash-Handa ea3572135b Added some code refactoring 2020-09-29 11:30:48 +05:30
Yash-Handa 8af73ba6b1 Executable files retain Icons with green color 2020-09-29 10:04:39 +05:30
Yash-Handa 15930b8262 Complete Revamp of File Struct(No end user change) 2020-09-29 09:10:44 +05:30
Yash HandaandGitHub c45daabca1 Merge pull request #8 from JojiiOfficial/master
Add AUR badge
2020-09-24 17:33:46 +05:30
Yash HandaandGitHub 5fdfaab1cf Update README.md 2020-09-24 17:33:07 +05:30
JojiiOfficialandGitHub a710756d07 Add TOC entry for Arch linux installation 2020-09-24 12:59:05 +02:00
JojiiOfficialandGitHub 288cc5531e Update README.md 2020-09-24 12:53:46 +02:00
JojiiOfficialandGitHub d5abf25cc9 Update README.md 2020-09-23 14:04:18 +02:00
Yasuhiro Matsumoto 503f937cf3 Fix .goreleaser.yml 2020-09-23 11:24:06 +09:00
Yasuhiro Matsumoto 1b76d79de4 Support Windows 2020-09-23 10:42:45 +09:00
Yash-Handa f6f6bee415 minor fixes 2020-09-16 20:01:48 +05:30
Yash-Handa 8be883a8de Added go get and Build from Source to README.md 2020-09-16 18:05:24 +05:30
Yash-Handa 3548235135 fixed a bug on list of very long file names 2020-09-16 17:16:33 +05:30
Yash-Handa e7baa8cbbd Added go.mod to .github dir 2020-09-16 13:47:41 +05:30
Yash-Handa 916334088e bumped up version to 1.3.4 2020-09-10 15:13:51 +05:30
Yash-Handa fc190fe213 Updated some images 2020-09-10 15:04:53 +05:30
Yash-Handa 325ede6a51 Added images to README.md 2020-09-10 14:40:27 +05:30
Yash-Handa 8476463bd1 added synopsis to ctw 2020-09-10 13:32:23 +05:30
Yash-Handa 66065a3e1c Add 14 linux based icons 2020-09-10 13:24:05 +05:30
Yash-Handa c6ef105c5c added some emojies to README.md 2020-09-10 12:03:04 +05:30
Yash HandaandGitHub 6ed2b350c8 Update README.md 2020-09-10 11:53:29 +05:30
Yash-Handa f8d272d2c4 Added other sections to README.md 2020-09-10 11:39:43 +05:30
Yash-Handa b93c27db79 Added TOC link to sections of README.md 2020-09-10 08:14:10 +05:30
Yash-Handa 01424c6d9d added Installation Section to README.md 2020-09-10 08:08:34 +05:30
Yash HandaandGitHub ead801831f Merge pull request #2 from Yash-Handa/add-code-of-conduct-1
Create CODE_OF_CONDUCT.md
2020-09-09 11:04:29 +05:30
Yash HandaandGitHub 1041ec04a5 Create CODE_OF_CONDUCT.md 2020-09-09 11:03:36 +05:30
Yash-Handa 830934334c Added basic structure to README.md. 2020-09-09 11:00:17 +05:30
Yash-Handa 2462e8de10 Added some Badges to README.md 2020-09-09 07:00:28 +05:30
Yash-Handa 601e3567d7 Updated the man page to current version 2020-09-09 01:25:45 +05:30
Yash-Handa 13a45eb843 Updated pre-commit hook for help2man 2020-09-09 01:23:31 +05:30
Yash-Handa e0b7546408 Bumped up version to 1.3.3 2020-09-09 01:20:54 +05:30
Yash-Handa 1b719af25b removed pre-push git hook in favour of goreleaser 2020-09-09 01:18:48 +05:30
Yash-Handa 8606cb53e0 Added .deb and .rpm packages 2020-09-09 01:17:30 +05:30
Yash-Handa 7e1e31f87f Integrated goreleaser with github 2020-09-08 23:44:38 +05:30
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
62 changed files with 4031 additions and 707 deletions
+9 -1
View File
@@ -1,9 +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
exec help2man -N -I logo-ls.h2m -o logo-ls.1 ./logo-ls
exec gzip -f logo-ls.1
exec git add logo-ls.1.gz
exit 0
-43
View File
@@ -1,43 +0,0 @@
#!/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
+1
View File
@@ -0,0 +1 @@
// An empty go.mod file to refrain this dir to be distributed with the cli tool
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: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

+36
View File
@@ -0,0 +1,36 @@
name: Go
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
+10
View File
@@ -17,3 +17,13 @@
# Do not commit the executable
logo-ls
build/
# distribution directory
dist
# env stuff
*.env
.gh_token
# test related data
testdata/dirEnv*
+101
View File
@@ -0,0 +1,101 @@
# 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: ~/Projects/Golang_Stuff/logo-ls/.gh_token
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
release:
github:
owner: Yash-Handa
name: logo-ls
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '(?i)update Readme.md'
nfpms:
-
file_name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
package_name: logo-ls
homepage: https://github.com/Yash-Handa/logo-ls
description: ls command with icons and git integration. Written in Golang
maintainer: Yash Handa <yashhanda7@yahoo.com>
license: MIT
formats:
- deb
- rpm
dependencies:
- git
recommends:
- golang
files:
"logo-ls.1.gz": "/usr/share/man/man1/logo-ls.1.gz"
+5
View File
@@ -0,0 +1,5 @@
{
"default": true,
"MD033": false,
"MD013": false
}
+76
View File
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at yashhanda7@yahoo.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
+27 -14
View File
@@ -1,14 +1,22 @@
```txt
Usage: logo-ls [-1?aAdgGhloRrSstUvVX] [-T value] [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
@@ -24,16 +32,21 @@ Usage: logo-ls [-1?aAdgGhloRrSstUvVX] [-T value] [files ...]
-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"
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).
```
+486 -1
View File
@@ -1,5 +1,490 @@
![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
modern ls command with vscode like file logos. Written in Golang
![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)
![AUR](https://img.shields.io/aur/version/logo-ls?style=flat-square&logo=Arch-Linux&labelColor=abcdef&label=AUR)
![deb](https://img.shields.io/badge/-Deb%20Package-A81D33?style=flat-square&logo=Debian&link=https://github.com/Yash-Handa/logo-ls/releases/)
![rpm](https://img.shields.io/badge/-RPM%20Package-EE0000?style=flat-square&logo=Red-Hat&link=https://github.com/Yash-Handa/logo-ls/releases/)
![linux](https://img.shields.io/badge/-Linux%20Binary-FCC624?style=flat-square&logo=Linux&logoColor=000000&link=https://github.com/Yash-Handa/logo-ls/releases/)
![apple](https://img.shields.io/badge/-Darwin%20Binary-999999?style=flat-square&logo=Apple&logoColor=ffffff&link=https://github.com/Yash-Handa/logo-ls/releases/)
![Go](https://github.com/Yash-Handa/logo-ls/workflows/Go/badge.svg)
modern ls command with beautiful Icons and Git Integrations . Written in Golang
<div>
<span align="center">
<img alt="logo-ls" title="logo-ls" src="/.github/images/ls.png">
</span>
</div><br>
Command and Arguments supported are listed in [HELP.md](/HELP.md)
## Table of contents
- [Features](#features)
- [Usage](#usage)
- [Flags](#flags)
- `-1`
- `-a` (or) `--all`
- `-A` (or) `--almost-all`
- `-D` (or) `--git-status`
- `-l`, `-o`, `-g`, `-G`
- `-R` (or) `--recursive`
- `-?` (or) `--help`
- Sorting:
- `-t`, `-S`, `-X`, `-U`, `-v` and `-r` (`--reverse`)
- `-T` (or) `--time-style=value`
- `-i` (or) `--disable-icon`
- `-c` (or) `--disable-color`
- [Combination of flags](#combination-of-flags)
- [Multiple Files and Directories](#multiple-files-and-directories)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Debian (.deb package)](#debian-deb-package)
- [Arch Linux (AUR)](#arch-linux)
- [Red Hat (.rpm package)](#red-hat-rpm-package)
- [MacOS (Darwin)](#macos-darwin)
- [Linux](#linux)
- [go get](#go-get)
- [Build from Source](#build-from-source)
- [Check the downloaded Resource](#check-the-downloaded-resource)
- [Recommended configurations](#recommended-configurations)
- [Updating](#updating)
- [Icon Set](#icon-set)
- [Contributing](#contributing)
- [License](#license)
## Features
[:arrow_up: TOC](#table-of-contents)
This project is build to add esthetics to ls(coreutiles) command
- Over 250+ icons :sunglasses:
- Supporting 600+ files, extensions and directories
- 16 Million, true colors supported
- Git Status Integration
- :racehorse: Near native speed. (thanks to Golang)
- Language agnostic binaries
This project is highly inspired by [ls(coreutiles)](https://www.gnu.org/software/coreutils/manual/html_node/ls-invocation.html#ls-invocation) and [color ls](https://github.com/athityakumar/colorls). The project tries to find a happy path between speed and aesthetics.
## Usage
[:arrow_up: TOC](#table-of-contents)
All supported flags can be found by using help flag `$ logo-ls -?`. The same has been provided as [HELP.md](/HELP.md).
The project also has its manpage which can be accessed by `man logo-ls`
### Flags
Almost all flags are same as that of the classic ls command and behave similarly. The project can be used as a drop-in replacement for the ls(coreutiles)
- With `-1`: List one entry per line
<div>
<span align="center">
<img alt="logo-ls -1" title="logo-ls -1" src="/.github/images/ls-1.png">
</span>
</div><br>
- With `-a` (or) `--all` : Does not ignore entries starting with '.'
<div>
<span align="center">
<img alt="logo-ls -a" title="logo-ls -a" src="/.github/images/ls-a.png">
</span>
</div><br>
- With `-A` (or) `--almost-all` : Does not ignore entries starting with '.', except `./` and `../`
<div>
<span align="center">
<img alt="logo-ls -A" title="logo-ls -A" src="/.github/images/ls-A.png">
</span>
</div><br>
- With `-D` (or) `--git-status`: Add Git Status to the listed Files and Directory
- *Note*: As much I would love to make this the default behavior of the command but showing git status is an intensive task and may slow (a tiny bit) the command itself. If you want you can make alias to the command with `-D` applied to it.
<div>
<span align="center">
<img alt="logo-ls -D" title="logo-ls -D" src="/.github/images/ls-D.png">
</span>
</div><br>
- With `-l`: Shows in long listing format
other similar commands are:
- `-o`: like `-l`, but do not list group information
- `-g`: like `-l`, but do not list owner
- `-G` (or) `--no-group`: in a long listing, don't print group names
<div>
<span align="center">
<img alt="logo-ls -l" title="logo-ls -l" src="/.github/images/ls-l.png">
</span>
</div><br>
- With `-R` (or) `--recursive`: list subdirectories recursively
<div>
<span align="center">
<img alt="logo-ls -R" title="logo-ls -R" src="/.github/images/ls-R.png">
</span>
</div><br>
- With `-?` (or) `--help`: print the help message
- similar message can be found at [HELP.md](/HELP.md).
<div>
<span align="center">
<img alt="logo-ls -?" title="logo-ls -?" src="/.github/images/ls-h.png">
</span>
</div><br>
- **Sorting**: There are many sorting flags available [default is *alphabetic order*]
- With `-t`: sort by modification time, newest first
- With `-S`: sort by file size, largest first
- With `-X`: sort alphabetically by entry extension
- With `-U`: do not sort; list entries in directory order
- With `-v`: natural sort of (version) numbers within text
- With `-r` (or) `-reverse`: reverse order while sorting
<div>
<span align="center">
<img alt="logo-ls -X" title="logo-ls -X" src="/.github/images/ls-X.png">
</span>
</div><br>
- With `-T` (or) `--time-style=value`: set time/date format in long formats (`-l`, `-o`, `-g`). There are many options to chose from all are listed in [HELP.md](/HELP.md).
<div>
<span align="center">
<img alt="logo-ls -T" title="logo-ls -T" src="/.github/images/ls-T.png">
</span>
</div><br>
- With `-i` (or) `--disable-icon`: don't print icons of the files
<div>
<span align="center">
<img alt="logo-ls -i" title="logo-ls -i" src="/.github/images/ls-i.png">
</span>
</div><br>
- With `-c` (or) `--disable-color`: don't color icons, filenames and git status
- *Note*: use a combination of `-ic` to print output to a file `$ logo-ls -ic > t.txt`
<div>
<span align="center">
<img alt="logo-ls -c" title="logo-ls -c" src="/.github/images/ls-c.png">
</span>
</div><br>
For all available commands see manpage or [HELP.md](/HELP.md)
### Combination of flags
This project uses [getopt](https://github.com/pborman/getopt) which is a golang variant of the classic getopt utility used in ls(coreutiles). Thus any combination of flags are possible and can be used.
<div>
<span align="center">
<img alt="logo-ls with flag combination" title="logo-ls with flag combination" src="/.github/images/ls-AshDt.png">
</span>
</div><br>
### Multiple Files and Directories
You can provide multiple files and directories as command argument [default to PWD] and all will be displayed accordingly.
<div>
<span align="center">
<img alt="logo-ls with multiple files" title="logo-ls with multiple files" src="/.github/images/ls multi.png">
</span>
</div><br>
## Prerequisites
[:arrow_up: TOC](#table-of-contents)
For proper working of `logo-ls` the following should be set
- **UTF-8**: The terminal should be UTF-8 encoded (Can display Unicode-Code Point)
- **True Color** Support: The terminal can display color (16 Million Colors). for more information of True Color and supported Terminals [see here](https://gist.github.com/XVilka/8346728)
- **Nerd Fonts**: Nerd fonts are required to display Icons on screen. Basically Nerd Fonts patches your current font i.e., the last few unicode points (approx 2,824 out of 143,859) in the font are replaced with nerdy icons :nerd_face:. The complete patching process is given [here](https://github.com/ryanoasis/nerd-fonts)
## Installation
[:arrow_up: TOC](#table-of-contents)
Installation is very easy and straight forward with many options to choose from.
As of now almost all installation methods require downloading resources from the Github Release page of the project, so to be a bit more secure consider **Checking the Signature** of `logo-ls_SHA512sums.txt` text file and then use this file to check weather the resource have been tampered. This complete process is explained in more detail in [Check the downloaded Resource](#check-the-downloaded-resource) section below. (This is a recommended step and not at all required)
### Debian (.deb package)
If you are on Debian or any other Debian based distribution then installation is simple.
#### Step 1
Download the `.deb` package from [Github Release Page](https://github.com/Yash-Handa/logo-ls/releases). Available OS_Architectures include: `i386`, `amd64`, `arm64` and `armV6`. Check your downloaded resource(s) if you like.
#### Step 2
Use the `dpkg -i path/to/downloaded/resource/` to install the binary and the manpage
### Red Hat (.rpm package)
If you are on Red Hat or any other Red Hat based distribution (like fedora) then installation is simple.
#### Step 1
Download the `.rpm` package from [Github Release Page](https://github.com/Yash-Handa/logo-ls/releases). Available OS_Architectures include: `i386`, `amd64`, `arm64` and `armV6`. Check your downloaded resource(s) if you like.
#### Step 2
Use the `rpm -i path/to/downloaded/resource/` to install the binary and the manpage
### Arch linux
Simply run `yay -S logo-ls`. (Or use the AUR helper of your choice)<br><br>
Alternatively you can clone the PKGBUILD and build the package manually:
```bash
git clone https://aur.archlinux.org/logo-ls.git
cd logo-ls
makepkg -si
```
### MacOS (Darwin)
To install `logo-ls` on darwin you have to download the binary. Support for Homebrew will come soon
#### Step 1
Download `logo-ls_Darwin_x86_64.tar.gz` from [Github Release Page](https://github.com/Yash-Handa/logo-ls/releases).
#### Step 2
Extract a gzipped archive in the current directory.
```cmd
$ tar -xzf logo-ls_Darwin_x86_64.tar.gz
```
This will produce `logo-ls_Darwin_x86_64` directory in the current directory with the following files: `HELP.md`, `LICENSE`, `logo-ls` and `logo-ls.1.gz`
#### Step 3
Install the binary `logo-ls` by placing it in `/usr/local/bin`
```cmd
$ cd logo-ls_Darwin_x86_64
$ sudo cp logo-ls /usr/local/bin
```
#### Step 4
If you want the man page of `logo-ls` place `logo-ls.1.gz` in `/usr/local/share/man/man1/`
```cmd
$ sudo cp logo-ls.1.gz /usr/local/share/man/man1/
```
### Linux
To install `logo-ls` on any other Linux Distribution you have to download the binary.
#### Step 1
Download the `.tar.gz` archive from [Github Release Page](https://github.com/Yash-Handa/logo-ls/releases). Available OS_Arch include: `i386`, `x86_64` (`amd64`), `arm64` and `armV6`. Check your downloaded resource(s) if you like.
#### Step 2
Extract a gzipped archive in the current directory.
```cmd
$ tar -xzf logo-ls_Linux_[ARCH].tar.gz
```
This will produce `logo-ls_Linux_[ARCH]` directory in the current directory with the following files: `HELP.md`, `LICENSE`, `logo-ls` and `logo-ls.1.gz`
#### Step 3
Install the binary `logo-ls` by placing it in `/usr/local/bin`
```cmd
$ cd logo-ls_Linux_[ARCH]
$ sudo cp logo-ls /usr/local/bin
```
#### Step 4
If you want the man page of `logo-ls` place `logo-ls.1.gz` in `/usr/share/man/man1/`
```cmd
$ sudo cp logo-ls.1.gz /usr/share/man/man1/
```
### go get
If you have [Golang](https://golang.org/) installed on your system then the `logo-ls` can be downloaded and installed using the the `go` cli tool provided by the language
#### Step 1
The `go` cli installs the binary in the directory specified by `$GOBIN` env variable [default: `~/go/bin/`]. In order to call `logo-ls` from anywhere in user-space, this directory which holds the binary must be present in `$PATH` env variable.
```cmd
$ echo $PATH
```
#### Step 2
Now simply install the binary using `go get` in home directory
```cmd
$ cd ~
$ go get github.com/Yash-Handa/logo-ls
```
### Build from Source
It is quite simple to build the command from source. You should have [Golang](https://golang.org/) installed on your system.
#### Step 1
Clone this repository.
```cmd
$ git clone https://github.com/Yash-Handa/logo-ls.git
```
#### Step 2
`cd` into the directory `logo-ls`. Then run `go mod tidy` to download the dependencies and after that `go build` to build your system specific binary
```cmd
$ cd logo-ls
$ go mod tidy
$ go build
```
the `go build` command will produce `logo-ls` executable binary in the current directory.
#### Step 3
Place the `logo-ls` executable in a directory reachable from `$PATH` env variable.
```cmd
$ sudo cp logo-ls /usr/local/bin
```
#### Step 4
If you want the man page of `logo-ls` place `logo-ls.1.gz` in `/usr/share/man/man1/`
```cmd
$ sudo cp logo-ls.1.gz /usr/share/man/man1/
```
### Check the downloaded Resource
After downloading the Resource(s) from the [Github Release Page](https://github.com/Yash-Handa/logo-ls/releases) follow the below steps to check its authenticity.
#### Step 1
Download `logo-ls_SHA512sums.txt.sig` and `logo-ls_SHA512sums.txt` from [Github Release Page](https://github.com/Yash-Handa/logo-ls/releases) and place them in the same directory as of the downloaded resource(s)
#### Step 2
Receive the public key of the signing party from `keyserver.ubuntu.com` server. This will add the developer's public key to your `keyring`.
```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
```
#### Step 3
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**)
#### Step 4
Use `logo-ls_SHA512sums.txt` file to verify the authenticity of the downloaded resource(s)
```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
```
## Recommended configurations
[:arrow_up: TOC](#table-of-contents)
To add some short command (say, `ils` or `ls`) with some flag options by default, add this to your shell configuration file (`~/.bashrc`, `~/.zshrc`, etc.) :
```bash
alias ils='logo-ls'
alias ila='logo-ls -A'
alias ill='logo-ls -al'
# equivalents with Git Status on by Default
alias ilsg='logo-ls -D'
alias ilag='logo-ls -AD'
alias illg='logo-ls -alD'
```
## Updating
[:arrow_up: TOC](#table-of-contents)
As of now Updating is exactly similar as installation for [Debian (.deb package)](#debian-deb-package), [Red Hat (.rpm package)](#red-hat-rpm-package), [MacOS (Darwin)](#macos-darwin) and [Linux](#linux)
## Icon Set
[:arrow_up: TOC](#table-of-contents)
<div>
<span align="center">
<img alt="icons" title="Icon Set" src="/.github/images/icons.png">
</span>
</div><br>
## Contributing
[:arrow_up: TOC](#table-of-contents)
The project is always open to contributions. Especially for:
- More Icons
- Better ways to distribute software
- Translations to other Languages (linguistic)
## License
[:arrow_up: TOC](#table-of-contents)
The project is licensed under **MIT**. The Licence is available [here](/LICENSE).
+61
View File
@@ -0,0 +1,61 @@
package assets
var Icon_Dir = map[string]*Icon_Info{
"config": Icon_Set["dir-config"],
".config": Icon_Set["dir-config"],
"configs": Icon_Set["dir-config"],
"configuration": Icon_Set["dir-config"],
"configurations": Icon_Set["dir-config"],
"settings": Icon_Set["dir-config"],
".settings": Icon_Set["dir-config"],
"META-INF": Icon_Set["dir-config"],
"controller": Icon_Set["dir-controller"],
"controllers": Icon_Set["dir-controller"],
"service": Icon_Set["dir-controller"],
"services": Icon_Set["dir-controller"],
"provider": Icon_Set["dir-controller"],
"providers": Icon_Set["dir-controller"],
".git": Icon_Set["dir-git"],
"githooks": Icon_Set["dir-git"],
".githooks": Icon_Set["dir-git"],
"submodules": Icon_Set["dir-git"],
".submodules": Icon_Set["dir-git"],
".github": Icon_Set["dir-github"],
"node_modules": Icon_Set["dir-npm"],
"include": Icon_Set["dir-include"],
"includes": Icon_Set["dir-include"],
"_includes": Icon_Set["dir-include"],
"import": Icon_Set["dir-import"],
"imports": Icon_Set["dir-import"],
"imported": Icon_Set["dir-import"],
"uploads": Icon_Set["dir-upload"],
"upload": Icon_Set["dir-upload"],
"downloads": Icon_Set["dir-download"],
"download": Icon_Set["dir-download"],
"auth": Icon_Set["dir-secure"],
"authentication": Icon_Set["dir-secure"],
"secure": Icon_Set["dir-secure"],
"security": Icon_Set["dir-secure"],
"cert": Icon_Set["dir-secure"],
"certs": Icon_Set["dir-secure"],
"certificate": Icon_Set["dir-secure"],
"certificates": Icon_Set["dir-secure"],
"ssl": Icon_Set["dir-secure"],
"images": Icon_Set["dir-images"],
"image": Icon_Set["dir-images"],
"pics": Icon_Set["dir-images"],
"pic": Icon_Set["dir-images"],
"pictures": Icon_Set["dir-images"],
"picture": Icon_Set["dir-images"],
"img": Icon_Set["dir-images"],
"icons": Icon_Set["dir-images"],
"icon": Icon_Set["dir-images"],
"ico": Icon_Set["dir-images"],
"screenshot": Icon_Set["dir-images"],
"screenshots": Icon_Set["dir-images"],
".env": Icon_Set["dir-environment"],
".environment": Icon_Set["dir-environment"],
"env": Icon_Set["dir-environment"],
"environment": Icon_Set["dir-environment"],
"environments": Icon_Set["dir-environment"],
}
+536
View File
@@ -0,0 +1,536 @@
package assets
var Icon_Ext = map[string]*Icon_Info{
"htm": Icon_Set["html"],
"html": Icon_Set["html"],
"xhtml": Icon_Set["html"],
"html_vm": Icon_Set["html"],
"asp": Icon_Set["html"],
"jade": Icon_Set["pug"],
"pug": Icon_Set["pug"],
"md": Icon_Set["markdown"],
"markdown": Icon_Set["markdown"],
"rst": Icon_Set["markdown"],
"blink": Icon_Set["blink"],
"css": Icon_Set["css"],
"scss": Icon_Set["sass"],
"sass": Icon_Set["sass"],
"less": Icon_Set["less"],
"json": Icon_Set["json"],
"tsbuildinfo": Icon_Set["json"],
"json5": Icon_Set["json"],
"jsonl": Icon_Set["json"],
"ndjson": Icon_Set["json"],
"jinja": Icon_Set["jinja"],
"jinja2": Icon_Set["jinja"],
"j2": Icon_Set["jinja"],
"jinja-html": Icon_Set["jinja"],
"sublime-project": Icon_Set["sublime"],
"sublime-workspace": Icon_Set["sublime"],
"yaml": Icon_Set["yaml"],
"yaml-tmlanguage": Icon_Set["yaml"],
"yml": Icon_Set["yaml"],
"xml": Icon_Set["xml"],
"plist": Icon_Set["xml"],
"xsd": Icon_Set["xml"],
"dtd": Icon_Set["xml"],
"xsl": Icon_Set["xml"],
"xslt": Icon_Set["xml"],
"resx": Icon_Set["xml"],
"iml": Icon_Set["xml"],
"xquery": Icon_Set["xml"],
"tmLanguage": Icon_Set["xml"],
"manifest": Icon_Set["xml"],
"project": Icon_Set["xml"],
"png": Icon_Set["image"],
"jpeg": Icon_Set["image"],
"jpg": Icon_Set["image"],
"gif": Icon_Set["image"],
"ico": Icon_Set["image"],
"tif": Icon_Set["image"],
"tiff": Icon_Set["image"],
"psd": Icon_Set["image"],
"psb": Icon_Set["image"],
"ami": Icon_Set["image"],
"apx": Icon_Set["image"],
"bmp": Icon_Set["image"],
"bpg": Icon_Set["image"],
"brk": Icon_Set["image"],
"cur": Icon_Set["image"],
"dds": Icon_Set["image"],
"dng": Icon_Set["image"],
"exr": Icon_Set["image"],
"fpx": Icon_Set["image"],
"gbr": Icon_Set["image"],
"img": Icon_Set["image"],
"jbig2": Icon_Set["image"],
"jb2": Icon_Set["image"],
"jng": Icon_Set["image"],
"jxr": Icon_Set["image"],
"pbm": Icon_Set["image"],
"pgf": Icon_Set["image"],
"pic": Icon_Set["image"],
"raw": Icon_Set["image"],
"webp": Icon_Set["image"],
"eps": Icon_Set["image"],
"afphoto": Icon_Set["image"],
"ase": Icon_Set["image"],
"aseprite": Icon_Set["image"],
"clip": Icon_Set["image"],
"cpt": Icon_Set["image"],
"heif": Icon_Set["image"],
"heic": Icon_Set["image"],
"kra": Icon_Set["image"],
"mdp": Icon_Set["image"],
"ora": Icon_Set["image"],
"pdn": Icon_Set["image"],
"reb": Icon_Set["image"],
"sai": Icon_Set["image"],
"tga": Icon_Set["image"],
"xcf": Icon_Set["image"],
"js": Icon_Set["javascript"],
"esx": Icon_Set["javascript"],
"mj": Icon_Set["javascript"],
"jsx": Icon_Set["react"],
"tsx": Icon_Set["react_ts"],
"ini": Icon_Set["settings"],
"dlc": Icon_Set["settings"],
"dll": Icon_Set["settings"],
"config": Icon_Set["settings"],
"conf": Icon_Set["settings"],
"properties": Icon_Set["settings"],
"prop": Icon_Set["settings"],
"settings": Icon_Set["settings"],
"option": Icon_Set["settings"],
"props": Icon_Set["settings"],
"toml": Icon_Set["settings"],
"prefs": Icon_Set["settings"],
"dotsettings": Icon_Set["settings"],
"cfg": Icon_Set["settings"],
"ts": Icon_Set["typescript"],
"marko": Icon_Set["markojs"],
"pdf": Icon_Set["pdf"],
"xlsx": Icon_Set["table"],
"xls": Icon_Set["table"],
"csv": Icon_Set["table"],
"tsv": Icon_Set["table"],
"vscodeignore": Icon_Set["vscode"],
"vsixmanifest": Icon_Set["vscode"],
"vsix": Icon_Set["vscode"],
"code-workplace": Icon_Set["vscode"],
"csproj": Icon_Set["visualstudio"],
"ruleset": Icon_Set["visualstudio"],
"sln": Icon_Set["visualstudio"],
"suo": Icon_Set["visualstudio"],
"vb": Icon_Set["visualstudio"],
"vbs": Icon_Set["visualstudio"],
"vcxitems": Icon_Set["visualstudio"],
"vcxproj": Icon_Set["visualstudio"],
"pdb": Icon_Set["database"],
"sql": Icon_Set["mysql"],
"pks": Icon_Set["database"],
"pkb": Icon_Set["database"],
"accdb": Icon_Set["database"],
"mdb": Icon_Set["database"],
"sqlite": Icon_Set["sqlite"],
"sqlite3": Icon_Set["sqlite"],
"pgsql": Icon_Set["postgresql"],
"postgres": Icon_Set["postgresql"],
"psql": Icon_Set["postgresql"],
"cs": Icon_Set["csharp"],
"csx": Icon_Set["csharp"],
"qs": Icon_Set["qsharp"],
"zip": Icon_Set["zip"],
"tar": Icon_Set["zip"],
"gz": Icon_Set["zip"],
"xz": Icon_Set["zip"],
"br": Icon_Set["zip"],
"bzip2": Icon_Set["zip"],
"gzip": Icon_Set["zip"],
"brotli": Icon_Set["zip"],
"7z": Icon_Set["zip"],
"rar": Icon_Set["zip"],
"tgz": Icon_Set["zip"],
"vala": Icon_Set["vala"],
"zig": Icon_Set["zig"],
"exe": Icon_Set["exe"],
"msi": Icon_Set["exe"],
"java": Icon_Set["java"],
"jar": Icon_Set["java"],
"jsp": Icon_Set["java"],
"c": Icon_Set["c"],
"m": Icon_Set["c"],
"i": Icon_Set["c"],
"mi": Icon_Set["c"],
"h": Icon_Set["h"],
"cc": Icon_Set["cpp"],
"cpp": Icon_Set["cpp"],
"cxx": Icon_Set["cpp"],
"c++": Icon_Set["cpp"],
"cp": Icon_Set["cpp"],
"mm": Icon_Set["cpp"],
"mii": Icon_Set["cpp"],
"ii": Icon_Set["cpp"],
"hh": Icon_Set["hpp"],
"hpp": Icon_Set["hpp"],
"hxx": Icon_Set["hpp"],
"h++": Icon_Set["hpp"],
"hp": Icon_Set["hpp"],
"tcc": Icon_Set["hpp"],
"inl": Icon_Set["hpp"],
"go": Icon_Set["go"],
"py": Icon_Set["python"],
"pyc": Icon_Set["python-misc"],
"whl": Icon_Set["python-misc"],
"url": Icon_Set["url"],
"sh": Icon_Set["console"],
"ksh": Icon_Set["console"],
"csh": Icon_Set["console"],
"tcsh": Icon_Set["console"],
"zsh": Icon_Set["console"],
"bash": Icon_Set["console"],
"bat": Icon_Set["console"],
"cmd": Icon_Set["console"],
"awk": Icon_Set["console"],
"fish": Icon_Set["console"],
"ps1": Icon_Set["powershell"],
"psm1": Icon_Set["powershell"],
"psd1": Icon_Set["powershell"],
"ps1xml": Icon_Set["powershell"],
"psc1": Icon_Set["powershell"],
"pssc": Icon_Set["powershell"],
"gradle": Icon_Set["gradle"],
"doc": Icon_Set["word"],
"docx": Icon_Set["word"],
"rtf": Icon_Set["word"],
"cer": Icon_Set["certificate"],
"cert": Icon_Set["certificate"],
"crt": Icon_Set["certificate"],
"pub": Icon_Set["key"],
"key": Icon_Set["key"],
"pem": Icon_Set["key"],
"asc": Icon_Set["key"],
"gpg": Icon_Set["key"],
"woff": Icon_Set["font"],
"woff2": Icon_Set["font"],
"ttf": Icon_Set["font"],
"eot": Icon_Set["font"],
"suit": Icon_Set["font"],
"otf": Icon_Set["font"],
"bmap": Icon_Set["font"],
"fnt": Icon_Set["font"],
"odttf": Icon_Set["font"],
"ttc": Icon_Set["font"],
"font": Icon_Set["font"],
"fonts": Icon_Set["font"],
"sui": Icon_Set["font"],
"ntf": Icon_Set["font"],
"mrf": Icon_Set["font"],
"lib": Icon_Set["lib"],
"bib": Icon_Set["lib"],
"rb": Icon_Set["ruby"],
"erb": Icon_Set["ruby"],
"fs": Icon_Set["fsharp"],
"fsx": Icon_Set["fsharp"],
"fsi": Icon_Set["fsharp"],
"fsproj": Icon_Set["fsharp"],
"swift": Icon_Set["swift"],
"ino": Icon_Set["arduino"],
"dockerignore": Icon_Set["docker"],
"dockerfile": Icon_Set["docker"],
"tex": Icon_Set["tex"],
"sty": Icon_Set["tex"],
"dtx": Icon_Set["tex"],
"ltx": Icon_Set["tex"],
"pptx": Icon_Set["powerpoint"],
"ppt": Icon_Set["powerpoint"],
"pptm": Icon_Set["powerpoint"],
"potx": Icon_Set["powerpoint"],
"potm": Icon_Set["powerpoint"],
"ppsx": Icon_Set["powerpoint"],
"ppsm": Icon_Set["powerpoint"],
"pps": Icon_Set["powerpoint"],
"ppam": Icon_Set["powerpoint"],
"ppa": Icon_Set["powerpoint"],
"webm": Icon_Set["video"],
"mkv": Icon_Set["video"],
"flv": Icon_Set["video"],
"vob": Icon_Set["video"],
"ogv": Icon_Set["video"],
"ogg": Icon_Set["video"],
"gifv": Icon_Set["video"],
"avi": Icon_Set["video"],
"mov": Icon_Set["video"],
"qt": Icon_Set["video"],
"wmv": Icon_Set["video"],
"yuv": Icon_Set["video"],
"rm": Icon_Set["video"],
"rmvb": Icon_Set["video"],
"mp4": Icon_Set["video"],
"m4v": Icon_Set["video"],
"mpg": Icon_Set["video"],
"mp2": Icon_Set["video"],
"mpeg": Icon_Set["video"],
"mpe": Icon_Set["video"],
"mpv": Icon_Set["video"],
"m2v": Icon_Set["video"],
"vdi": Icon_Set["virtual"],
"vbox": Icon_Set["virtual"],
"vbox-prev": Icon_Set["virtual"],
"ics": Icon_Set["email"],
"mp3": Icon_Set["audio"],
"flac": Icon_Set["audio"],
"m4a": Icon_Set["audio"],
"wma": Icon_Set["audio"],
"aiff": Icon_Set["audio"],
"coffee": Icon_Set["coffee"],
"cson": Icon_Set["coffee"],
"iced": Icon_Set["coffee"],
"txt": Icon_Set["document"],
"graphql": Icon_Set["graphql"],
"gql": Icon_Set["graphql"],
"rs": Icon_Set["rust"],
"raml": Icon_Set["raml"],
"xaml": Icon_Set["xaml"],
"hs": Icon_Set["haskell"],
"kt": Icon_Set["kotlin"],
"kts": Icon_Set["kotlin"],
"patch": Icon_Set["git"],
"lua": Icon_Set["lua"],
"clj": Icon_Set["clojure"],
"cljs": Icon_Set["clojure"],
"cljc": Icon_Set["clojure"],
"groovy": Icon_Set["groovy"],
"r": Icon_Set["r"],
"rmd": Icon_Set["r"],
"dart": Icon_Set["dart"],
"as": Icon_Set["actionscript"],
"mxml": Icon_Set["mxml"],
"ahk": Icon_Set["autohotkey"],
"swf": Icon_Set["flash"],
"swc": Icon_Set["swc"],
"cmake": Icon_Set["cmake"],
"asm": Icon_Set["assembly"],
"a51": Icon_Set["assembly"],
"inc": Icon_Set["assembly"],
"nasm": Icon_Set["assembly"],
"s": Icon_Set["assembly"],
"ms": Icon_Set["assembly"],
"agc": Icon_Set["assembly"],
"ags": Icon_Set["assembly"],
"aea": Icon_Set["assembly"],
"argus": Icon_Set["assembly"],
"mitigus": Icon_Set["assembly"],
"binsource": Icon_Set["assembly"],
"vue": Icon_Set["vue"],
"ml": Icon_Set["ocaml"],
"mli": Icon_Set["ocaml"],
"cmx": Icon_Set["ocaml"],
"lock": Icon_Set["lock"],
"hbs": Icon_Set["handlebars"],
"mustache": Icon_Set["handlebars"],
"pm": Icon_Set["perl"],
"raku": Icon_Set["perl"],
"hx": Icon_Set["haxe"],
"pp": Icon_Set["puppet"],
"ex": Icon_Set["elixir"],
"exs": Icon_Set["elixir"],
"eex": Icon_Set["elixir"],
"leex": Icon_Set["elixir"],
"erl": Icon_Set["erlang"],
"twig": Icon_Set["twig"],
"jl": Icon_Set["julia"],
"elm": Icon_Set["elm"],
"pure": Icon_Set["purescript"],
"purs": Icon_Set["purescript"],
"tpl": Icon_Set["smarty"],
"styl": Icon_Set["stylus"],
"merlin": Icon_Set["merlin"],
"v": Icon_Set["verilog"],
"vhd": Icon_Set["verilog"],
"sv": Icon_Set["verilog"],
"svh": Icon_Set["verilog"],
"robot": Icon_Set["robot"],
"sol": Icon_Set["solidity"],
"yang": Icon_Set["yang"],
"mjml": Icon_Set["mjml"],
"tf": Icon_Set["terraform"],
"tfvars": Icon_Set["terraform"],
"tfstate": Icon_Set["terraform"],
"applescript": Icon_Set["applescript"],
"ipa": Icon_Set["applescript"],
"cake": Icon_Set["cake"],
"nim": Icon_Set["nim"],
"nimble": Icon_Set["nim"],
"apib": Icon_Set["apiblueprint"],
"apiblueprint": Icon_Set["apiblueprint"],
"pcss": Icon_Set["postcss"],
"sss": Icon_Set["postcss"],
"todo": Icon_Set["todo"],
"nix": Icon_Set["nix"],
"slim": Icon_Set["slim"],
"http": Icon_Set["http"],
"rest": Icon_Set["http"],
"apk": Icon_Set["android"],
"env": Icon_Set["tune"],
"jenkinsfile": Icon_Set["jenkins"],
"jenkins": Icon_Set["jenkins"],
"log": Icon_Set["log"],
"ejs": Icon_Set["ejs"],
"djt": Icon_Set["django"],
"pot": Icon_Set["i18n"],
"po": Icon_Set["i18n"],
"mo": Icon_Set["i18n"],
"d": Icon_Set["d"],
"mdx": Icon_Set["mdx"],
"gd": Icon_Set["godot"],
"godot": Icon_Set["godot-assets"],
"tres": Icon_Set["godot-assets"],
"tscn": Icon_Set["godot-assets"],
"azcli": Icon_Set["azure"],
"vagrantfile": Icon_Set["vagrant"],
"cshtml": Icon_Set["razor"],
"vbhtml": Icon_Set["razor"],
"ad": Icon_Set["asciidoc"],
"adoc": Icon_Set["asciidoc"],
"asciidoc": Icon_Set["asciidoc"],
"edge": Icon_Set["edge"],
"ss": Icon_Set["scheme"],
"scm": Icon_Set["scheme"],
"stl": Icon_Set["3d"],
"obj": Icon_Set["3d"],
"ac": Icon_Set["3d"],
"blend": Icon_Set["3d"],
"mesh": Icon_Set["3d"],
"mqo": Icon_Set["3d"],
"pmd": Icon_Set["3d"],
"pmx": Icon_Set["3d"],
"skp": Icon_Set["3d"],
"vac": Icon_Set["3d"],
"vdp": Icon_Set["3d"],
"vox": Icon_Set["3d"],
"svg": Icon_Set["svg"],
"vimrc": Icon_Set["vim"],
"gvimrc": Icon_Set["vim"],
"exrc": Icon_Set["vim"],
"moon": Icon_Set["moonscript"],
"iso": Icon_Set["disc"],
"f": Icon_Set["fortran"],
"f77": Icon_Set["fortran"],
"f90": Icon_Set["fortran"],
"f95": Icon_Set["fortran"],
"f03": Icon_Set["fortran"],
"f08": Icon_Set["fortran"],
"tcl": Icon_Set["tcl"],
"liquid": Icon_Set["liquid"],
"p": Icon_Set["prolog"],
"pro": Icon_Set["prolog"],
"coco": Icon_Set["coconut"],
"sketch": Icon_Set["sketch"],
"opam": Icon_Set["opam"],
"dhallb": Icon_Set["dhall"],
"pwn": Icon_Set["pawn"],
"amx": Icon_Set["pawn"],
"dhall": Icon_Set["dhall"],
"pas": Icon_Set["pascal"],
"unity": Icon_Set["shaderlab"],
"nupkg": Icon_Set["nuget"],
"command": Icon_Set["command"],
"dsc": Icon_Set["denizenscript"],
"deb": Icon_Set["debian"],
"rpm": Icon_Set["redhat"],
"snap": Icon_Set["ubuntu"],
"ebuild": Icon_Set["gentoo"],
"pkg": Icon_Set["applescript"],
"openbsd": Icon_Set["freebsd"],
// "ls": Icon_Set["livescript"],
// "re": Icon_Set["reason"],
// "rei": Icon_Set["reason"],
// "cmj": Icon_Set["bucklescript"],
// "nb": Icon_Set["mathematica"],
// "wl": Icon_Set["wolframlanguage"],
// "wls": Icon_Set["wolframlanguage"],
// "njk": Icon_Set["nunjucks"],
// "nunjucks": Icon_Set["nunjucks"],
// "au3": Icon_Set["autoit"],
// "haml": Icon_Set["haml"],
// "feature": Icon_Set["cucumber"],
// "riot": Icon_Set["riot"],
// "tag": Icon_Set["riot"],
// "vfl": Icon_Set["vfl"],
// "kl": Icon_Set["kl"],
// "cfml": Icon_Set["coldfusion"],
// "cfc": Icon_Set["coldfusion"],
// "lucee": Icon_Set["coldfusion"],
// "cfm": Icon_Set["coldfusion"],
// "cabal": Icon_Set["cabal"],
// "rql": Icon_Set["restql"],
// "restql": Icon_Set["restql"],
// "kv": Icon_Set["kivy"],
// "graphcool": Icon_Set["graphcool"],
// "sbt": Icon_Set["sbt"],
// "cr": Icon_Set["crystal"],
// "ecr": Icon_Set["crystal"],
// "cu": Icon_Set["cuda"],
// "cuh": Icon_Set["cuda"],
// "def": Icon_Set["dotjs"],
// "dot": Icon_Set["dotjs"],
// "jst": Icon_Set["dotjs"],
// "pde": Icon_Set["processing"],
// "wpy": Icon_Set["wepy"],
// "hcl": Icon_Set["hcl"],
// "san": Icon_Set["san"],
// "red": Icon_Set["red"],
// "fxp": Icon_Set["foxpro"],
// "prg": Icon_Set["foxpro"],
// "wat": Icon_Set["webassembly"],
// "wasm": Icon_Set["webassembly"],
// "ipynb": Icon_Set["jupyter"],
// "bal": Icon_Set["ballerina"],
// "balx": Icon_Set["ballerina"],
// "rkt": Icon_Set["racket"],
// "bzl": Icon_Set["bazel"],
// "bazel": Icon_Set["bazel"],
// "mint": Icon_Set["mint"],
// "vm": Icon_Set["velocity"],
// "fhtml": Icon_Set["velocity"],
// "vtl": Icon_Set["velocity"],
// "prisma": Icon_Set["prisma"],
// "abc": Icon_Set["abc"],
// "lisp": Icon_Set["lisp"],
// "lsp": Icon_Set["lisp"],
// "cl": Icon_Set["lisp"],
// "fast": Icon_Set["lisp"],
// "svelte": Icon_Set["svelte"],
// "prw": Icon_Set["advpl_prw"],
// "prx": Icon_Set["advpl_prw"],
// "ptm": Icon_Set["advpl_ptm"],
// "tlpp": Icon_Set["advpl_tlpp"],
// "ch": Icon_Set["advpl_include"],
// "4th": Icon_Set["forth"],
// "fth": Icon_Set["forth"],
// "frt": Icon_Set["forth"],
// "iuml": Icon_Set["uml"],
// "pu": Icon_Set["uml"],
// "puml": Icon_Set["uml"],
// "plantuml": Icon_Set["uml"],
// "wsd": Icon_Set["uml"],
// "sml": Icon_Set["sml"],
// "mlton": Icon_Set["sml"],
// "mlb": Icon_Set["sml"],
// "sig": Icon_Set["sml"],
// "fun": Icon_Set["sml"],
// "cm": Icon_Set["sml"],
// "lex": Icon_Set["sml"],
// "use": Icon_Set["sml"],
// "grm": Icon_Set["sml"],
// "imba": Icon_Set["imba"],
// "drawio": Icon_Set["drawio"],
// "dio": Icon_Set["drawio"],
// "sas": Icon_Set["sas"],
// "sas7bdat": Icon_Set["sas"],
// "sashdat": Icon_Set["sas"],
// "astore": Icon_Set["sas"],
// "ast": Icon_Set["sas"],
// "sast": Icon_Set["sas"],
}
+414
View File
@@ -0,0 +1,414 @@
package assets
var Icon_FileName = map[string]*Icon_Info{
".pug-lintrc": Icon_Set["pug"],
".pug-lintrc.js": Icon_Set["pug"],
".pug-lintrc.json": Icon_Set["pug"],
".jscsrc": Icon_Set["json"],
".jshintrc": Icon_Set["json"],
"composer.lock": Icon_Set["json"],
".jsbeautifyrc": Icon_Set["json"],
".esformatter": Icon_Set["json"],
"cdp.pid": Icon_Set["json"],
".mjmlconfig": Icon_Set["json"],
".htaccess": Icon_Set["xml"],
".jshintignore": Icon_Set["settings"],
".buildignore": Icon_Set["settings"],
".mrconfig": Icon_Set["settings"],
".yardopts": Icon_Set["settings"],
"manifest.mf": Icon_Set["settings"],
".clang-format": Icon_Set["settings"],
".clang-tidy": Icon_Set["settings"],
"go.mod": Icon_Set["go-mod"],
"go.sum": Icon_Set["go-mod"],
"requirements.txt": Icon_Set["python-misc"],
"pipfile": Icon_Set["python-misc"],
".python-version": Icon_Set["python-misc"],
"manifest.in": Icon_Set["python-misc"],
"gradle.properties": Icon_Set["gradle"],
"gradlew": Icon_Set["gradle"],
"gradle-wrapper.properties": Icon_Set["gradle"],
"license": Icon_Set["certificate"],
"license.md": Icon_Set["certificate"],
"license.txt": Icon_Set["certificate"],
"licence": Icon_Set["certificate"],
"licence.md": Icon_Set["certificate"],
"licence.txt": Icon_Set["certificate"],
"unlicense": Icon_Set["certificate"],
"unlicense.md": Icon_Set["certificate"],
"unlicense.txt": Icon_Set["certificate"],
".htpasswd": Icon_Set["key"],
"gemfile": Icon_Set["gemfile"],
"dockerfile": Icon_Set["docker"],
"dockerfile.prod": Icon_Set["docker"],
"dockerfile.production": Icon_Set["docker"],
"docker-compose.yml": Icon_Set["docker"],
"docker-compose.yaml": Icon_Set["docker"],
"docker-compose.dev.yml": Icon_Set["docker"],
"docker-compose.local.yml": Icon_Set["docker"],
"docker-compose.ci.yml": Icon_Set["docker"],
"docker-compose.override.yml": Icon_Set["docker"],
"docker-compose.staging.yml": Icon_Set["docker"],
"docker-compose.prod.yml": Icon_Set["docker"],
"docker-compose.production.yml": Icon_Set["docker"],
"docker-compose.test.yml": Icon_Set["docker"],
".mailmap": Icon_Set["email"],
".graphqlconfig": Icon_Set["graphql"],
".gitignore": Icon_Set["git"],
".gitconfig": Icon_Set["git"],
".gitattributes": Icon_Set["git"],
".gitmodules": Icon_Set["git"],
".gitkeep": Icon_Set["git"],
"git-history": Icon_Set["git"],
".luacheckrc": Icon_Set["lua"],
".Rhistory": Icon_Set["r"],
"cmakelists.txt": Icon_Set["cmake"],
"cmakecache.txt": Icon_Set["cmake"],
"vue.config.js": Icon_Set["vue-config"],
"vue.config.ts": Icon_Set["vue-config"],
"nuxt.config.js": Icon_Set["nuxt"],
"nuxt.config.ts": Icon_Set["nuxt"],
"security.md": Icon_Set["lock"],
"security.txt": Icon_Set["lock"],
"security": Icon_Set["lock"],
"vercel.json": Icon_Set["vercel"],
".vercelignore": Icon_Set["vercel"],
"now.json": Icon_Set["vercel"],
".nowignore": Icon_Set["vercel"],
"postcss.config.js": Icon_Set["postcss"],
".postcssrc.js": Icon_Set["postcss"],
".postcssrc": Icon_Set["postcss"],
".postcssrc.json": Icon_Set["postcss"],
".postcssrc.yml": Icon_Set["postcss"],
"CNAME": Icon_Set["http"],
"webpack.js": Icon_Set["webpack"],
"webpack.ts": Icon_Set["webpack"],
"webpack.base.js": Icon_Set["webpack"],
"webpack.base.ts": Icon_Set["webpack"],
"webpack.config.js": Icon_Set["webpack"],
"webpack.config.ts": Icon_Set["webpack"],
"webpack.common.js": Icon_Set["webpack"],
"webpack.common.ts": Icon_Set["webpack"],
"webpack.config.common.js": Icon_Set["webpack"],
"webpack.config.common.ts": Icon_Set["webpack"],
"webpack.config.common.babel.js": Icon_Set["webpack"],
"webpack.config.common.babel.ts": Icon_Set["webpack"],
"webpack.dev.js": Icon_Set["webpack"],
"webpack.dev.ts": Icon_Set["webpack"],
"webpack.development.js": Icon_Set["webpack"],
"webpack.development.ts": Icon_Set["webpack"],
"webpack.config.dev.js": Icon_Set["webpack"],
"webpack.config.dev.ts": Icon_Set["webpack"],
"webpack.config.dev.babel.js": Icon_Set["webpack"],
"webpack.config.dev.babel.ts": Icon_Set["webpack"],
"webpack.prod.js": Icon_Set["webpack"],
"webpack.prod.ts": Icon_Set["webpack"],
"webpack.production.js": Icon_Set["webpack"],
"webpack.production.ts": Icon_Set["webpack"],
"webpack.server.js": Icon_Set["webpack"],
"webpack.server.ts": Icon_Set["webpack"],
"webpack.client.js": Icon_Set["webpack"],
"webpack.client.ts": Icon_Set["webpack"],
"webpack.config.server.js": Icon_Set["webpack"],
"webpack.config.server.ts": Icon_Set["webpack"],
"webpack.config.client.js": Icon_Set["webpack"],
"webpack.config.client.ts": Icon_Set["webpack"],
"webpack.config.production.babel.js": Icon_Set["webpack"],
"webpack.config.production.babel.ts": Icon_Set["webpack"],
"webpack.config.prod.babel.js": Icon_Set["webpack"],
"webpack.config.prod.babel.ts": Icon_Set["webpack"],
"webpack.config.prod.js": Icon_Set["webpack"],
"webpack.config.prod.ts": Icon_Set["webpack"],
"webpack.config.production.js": Icon_Set["webpack"],
"webpack.config.production.ts": Icon_Set["webpack"],
"webpack.config.staging.js": Icon_Set["webpack"],
"webpack.config.staging.ts": Icon_Set["webpack"],
"webpack.config.babel.js": Icon_Set["webpack"],
"webpack.config.babel.ts": Icon_Set["webpack"],
"webpack.config.base.babel.js": Icon_Set["webpack"],
"webpack.config.base.babel.ts": Icon_Set["webpack"],
"webpack.config.base.js": Icon_Set["webpack"],
"webpack.config.base.ts": Icon_Set["webpack"],
"webpack.config.staging.babel.js": Icon_Set["webpack"],
"webpack.config.staging.babel.ts": Icon_Set["webpack"],
"webpack.config.coffee": Icon_Set["webpack"],
"webpack.config.test.js": Icon_Set["webpack"],
"webpack.config.test.ts": Icon_Set["webpack"],
"webpack.config.vendor.js": Icon_Set["webpack"],
"webpack.config.vendor.ts": Icon_Set["webpack"],
"webpack.config.vendor.production.js": Icon_Set["webpack"],
"webpack.config.vendor.production.ts": Icon_Set["webpack"],
"webpack.test.js": Icon_Set["webpack"],
"webpack.test.ts": Icon_Set["webpack"],
"webpack.dist.js": Icon_Set["webpack"],
"webpack.dist.ts": Icon_Set["webpack"],
"webpackfile.js": Icon_Set["webpack"],
"webpackfile.ts": Icon_Set["webpack"],
"ionic.config.json": Icon_Set["ionic"],
".io-config.json": Icon_Set["ionic"],
"gulpfile.js": Icon_Set["gulp"],
"gulpfile.mjs": Icon_Set["gulp"],
"gulpfile.ts": Icon_Set["gulp"],
"gulpfile.babel.js": Icon_Set["gulp"],
"package.json": Icon_Set["nodejs"],
"package-lock.json": Icon_Set["nodejs"],
".nvmrc": Icon_Set["nodejs"],
".esmrc": Icon_Set["nodejs"],
".node-version": Icon_Set["nodejs"],
".npmignore": Icon_Set["npm"],
".npmrc": Icon_Set["npm"],
".yarnrc": Icon_Set["yarn"],
"yarn.lock": Icon_Set["yarn"],
".yarnclean": Icon_Set["yarn"],
".yarn-integrity": Icon_Set["yarn"],
"yarn-error.log": Icon_Set["yarn"],
".yarnrc.yml": Icon_Set["yarn"],
".yarnrc.yaml": Icon_Set["yarn"],
"androidmanifest.xml": Icon_Set["android"],
".env.defaults": Icon_Set["tune"],
".env.example": Icon_Set["tune"],
".env.sample": Icon_Set["tune"],
".env.schema": Icon_Set["tune"],
".env.local": Icon_Set["tune"],
".env.dev": Icon_Set["tune"],
".env.development": Icon_Set["tune"],
".env.qa": Icon_Set["tune"],
".env.prod": Icon_Set["tune"],
".env.production": Icon_Set["tune"],
".env.staging": Icon_Set["tune"],
".env.preview": Icon_Set["tune"],
".env.test": Icon_Set["tune"],
".env.testing": Icon_Set["tune"],
".env.development.local": Icon_Set["tune"],
".env.qa.local": Icon_Set["tune"],
".env.production.local": Icon_Set["tune"],
".env.staging.local": Icon_Set["tune"],
".env.test.local": Icon_Set["tune"],
".babelrc": Icon_Set["babel"],
".babelrc.js": Icon_Set["babel"],
".babelrc.json": Icon_Set["babel"],
"babel.config.json": Icon_Set["babel"],
"babel.config.js": Icon_Set["babel"],
"contributing.md": Icon_Set["contributing"],
"readme.md": Icon_Set["readme"],
"readme.txt": Icon_Set["readme"],
"readme": Icon_Set["readme"],
"changelog": Icon_Set["changelog"],
"changelog.md": Icon_Set["changelog"],
"changelog.txt": Icon_Set["changelog"],
"changes": Icon_Set["changelog"],
"changes.md": Icon_Set["changelog"],
"changes.txt": Icon_Set["changelog"],
"credits": Icon_Set["credits"],
"credits.txt": Icon_Set["credits"],
"credits.md": Icon_Set["credits"],
"authors": Icon_Set["authors"],
"authors.md": Icon_Set["authors"],
"authors.txt": Icon_Set["authors"],
"favicon.ico": Icon_Set["favicon"],
"karma.conf.js": Icon_Set["karma"],
"karma.conf.ts": Icon_Set["karma"],
"karma.conf.coffee": Icon_Set["karma"],
"karma.config.js": Icon_Set["karma"],
"karma.config.ts": Icon_Set["karma"],
"karma-main.js": Icon_Set["karma"],
"karma-main.ts": Icon_Set["karma"],
".travis.yml": Icon_Set["travis"],
".codecov.yml": Icon_Set["codecov"],
"codecov.yml": Icon_Set["codecov"],
"protractor.conf.js": Icon_Set["protractor"],
"protractor.conf.ts": Icon_Set["protractor"],
"protractor.conf.coffee": Icon_Set["protractor"],
"protractor.config.js": Icon_Set["protractor"],
"protractor.config.ts": Icon_Set["protractor"],
"procfile": Icon_Set["heroku"],
"procfile.windows": Icon_Set["heroku"],
".bowerrc": Icon_Set["bower"],
"bower.json": Icon_Set["bower"],
".eslintrc.js": Icon_Set["eslint"],
".eslintrc.cjs": Icon_Set["eslint"],
".eslintrc.yaml": Icon_Set["eslint"],
".eslintrc.yml": Icon_Set["eslint"],
".eslintrc.json": Icon_Set["eslint"],
".eslintrc": Icon_Set["eslint"],
".eslintignore": Icon_Set["eslint"],
".eslintcache": Icon_Set["eslint"],
"code_of_conduct.md": Icon_Set["conduct"],
"code_of_conduct.txt": Icon_Set["conduct"],
"mocha.opts": Icon_Set["mocha"],
".mocharc.yml": Icon_Set["mocha"],
".mocharc.yaml": Icon_Set["mocha"],
".mocharc.js": Icon_Set["mocha"],
".mocharc.json": Icon_Set["mocha"],
".mocharc.jsonc": Icon_Set["mocha"],
"jenkinsfile": Icon_Set["jenkins"],
"firebase.json": Icon_Set["firebase"],
".firebaserc": Icon_Set["firebase"],
"firestore.rules": Icon_Set["firebase"],
"firestore.indexes.json": Icon_Set["firebase"],
".stylelintrc": Icon_Set["stylelint"],
"stylelint.config.js": Icon_Set["stylelint"],
".stylelintrc.json": Icon_Set["stylelint"],
".stylelintrc.yaml": Icon_Set["stylelint"],
".stylelintrc.yml": Icon_Set["stylelint"],
".stylelintrc.js": Icon_Set["stylelint"],
".stylelintignore": Icon_Set["stylelint"],
".codeclimate.yml": Icon_Set["code-climate"],
".prettierrc": Icon_Set["prettier"],
"prettier.config.js": Icon_Set["prettier"],
".prettierrc.js": Icon_Set["prettier"],
".prettierrc.json": Icon_Set["prettier"],
".prettierrc.yaml": Icon_Set["prettier"],
".prettierrc.yml": Icon_Set["prettier"],
".prettierignore": Icon_Set["prettier"],
"gruntfile.js": Icon_Set["grunt"],
"gruntfile.ts": Icon_Set["grunt"],
"gruntfile.coffee": Icon_Set["grunt"],
"gruntfile.babel.js": Icon_Set["grunt"],
"gruntfile.babel.ts": Icon_Set["grunt"],
"gruntfile.babel.coffee": Icon_Set["grunt"],
"jest.config.js": Icon_Set["jest"],
"jest.config.ts": Icon_Set["jest"],
"jest.config.cjs": Icon_Set["jest"],
"jest.config.mjs": Icon_Set["jest"],
"jest.config.json": Icon_Set["jest"],
"jest.e2e.config.js": Icon_Set["jest"],
"jest.e2e.config.ts": Icon_Set["jest"],
"jest.e2e.config.cjs": Icon_Set["jest"],
"jest.e2e.config.mjs": Icon_Set["jest"],
"jest.e2e.config.json": Icon_Set["jest"],
"jest.setup.js": Icon_Set["jest"],
"jest.setup.ts": Icon_Set["jest"],
"jest.json": Icon_Set["jest"],
".jestrc": Icon_Set["jest"],
".jestrc.js": Icon_Set["jest"],
".jestrc.json": Icon_Set["jest"],
"jest.teardown.js": Icon_Set["jest"],
"fastfile": Icon_Set["fastlane"],
"appfile": Icon_Set["fastlane"],
".helmignore": Icon_Set["helm"],
"makefile": Icon_Set["makefile"],
".releaserc": Icon_Set["semantic-release"],
".releaserc.yaml": Icon_Set["semantic-release"],
".releaserc.yml": Icon_Set["semantic-release"],
".releaserc.json": Icon_Set["semantic-release"],
".releaserc.js": Icon_Set["semantic-release"],
"release.config.js": Icon_Set["semantic-release"],
"bitbucket-pipelines.yaml": Icon_Set["bitbucket"],
"bitbucket-pipelines.yml": Icon_Set["bitbucket"],
"azure-pipelines.yml": Icon_Set["azure-pipelines"],
"azure-pipelines.yaml": Icon_Set["azure-pipelines"],
"vagrantfile": Icon_Set["vagrant"],
"tailwind.js": Icon_Set["tailwindcss"],
"tailwind.config.js": Icon_Set["tailwindcss"],
"codeowners": Icon_Set["codeowners"],
".gcloudignore": Icon_Set["gcp"],
".huskyrc": Icon_Set["husky"],
"husky.config.js": Icon_Set["husky"],
".huskyrc.json": Icon_Set["husky"],
".huskyrc.js": Icon_Set["husky"],
".huskyrc.yaml": Icon_Set["husky"],
".huskyrc.yml": Icon_Set["husky"],
".commitlintrc": Icon_Set["commitlint"],
".commitlintrc.js": Icon_Set["commitlint"],
"commitlint.config.js": Icon_Set["commitlint"],
".commitlintrc.json": Icon_Set["commitlint"],
".commitlint.yaml": Icon_Set["commitlint"],
".commitlint.yml": Icon_Set["commitlint"],
"dune": Icon_Set["dune"],
"dune-project": Icon_Set["dune"],
"roadmap.md": Icon_Set["roadmap"],
"roadmap.txt": Icon_Set["roadmap"],
"timeline.md": Icon_Set["roadmap"],
"timeline.txt": Icon_Set["roadmap"],
"milestones.md": Icon_Set["roadmap"],
"milestones.txt": Icon_Set["roadmap"],
"nuget.config": Icon_Set["nuget"],
".nuspec": Icon_Set["nuget"],
"nuget.exe": Icon_Set["nuget"],
"stryker.conf.js": Icon_Set["stryker"],
"stryker.conf.json": Icon_Set["stryker"],
".modernizrrc": Icon_Set["modernizr"],
".modernizrrc.js": Icon_Set["modernizr"],
".modernizrrc.json": Icon_Set["modernizr"],
"routing.ts": Icon_Set["routing"],
"routing.tsx": Icon_Set["routing"],
"routing.js": Icon_Set["routing"],
"routing.jsx": Icon_Set["routing"],
"routes.ts": Icon_Set["routing"],
"routes.tsx": Icon_Set["routing"],
"routes.js": Icon_Set["routing"],
"routes.jsx": Icon_Set["routing"],
// ".vfl": Icon_Set["vfl"],
// ".kl": Icon_Set["kl"],
// "project.graphcool": Icon_Set["graphcool"],
// ".flowconfig": Icon_Set["flow"],
// ".bithoundrc": Icon_Set["bithound"],
// ".appveyor.yml": Icon_Set["appveyor"],
// "appveyor.yml": Icon_Set["appveyor"],
// "fuse.js": Icon_Set["fusebox"],
// ".editorconfig": Icon_Set["editorconfig"],
// ".watchmanconfig": Icon_Set["watchman"],
// "aurelia.json": Icon_Set["aurelia"],
// "rollup.config.js": Icon_Set["rollup"],
// "rollup.config.ts": Icon_Set["rollup"],
// "rollup-config.js": Icon_Set["rollup"],
// "rollup-config.ts": Icon_Set["rollup"],
// "rollup.config.common.js": Icon_Set["rollup"],
// "rollup.config.common.ts": Icon_Set["rollup"],
// "rollup.config.base.js": Icon_Set["rollup"],
// "rollup.config.base.ts": Icon_Set["rollup"],
// "rollup.config.prod.js": Icon_Set["rollup"],
// "rollup.config.prod.ts": Icon_Set["rollup"],
// "rollup.config.dev.js": Icon_Set["rollup"],
// "rollup.config.dev.ts": Icon_Set["rollup"],
// "rollup.config.prod.vendor.js": Icon_Set["rollup"],
// "rollup.config.prod.vendor.ts": Icon_Set["rollup"],
// ".hhconfig": Icon_Set["hack"],
// "apollo.config.js": Icon_Set["apollo"],
// "nodemon.json": Icon_Set["nodemon"],
// "nodemon-debug.json": Icon_Set["nodemon"],
// ".hintrc": Icon_Set["webhint"],
// "browserslist": Icon_Set["browserlist"],
// ".browserslistrc": Icon_Set["browserlist"],
// ".snyk": Icon_Set["snyk"],
// ".drone.yml": Icon_Set["drone"],
// ".sequelizerc": Icon_Set["sequelize"],
// "gatsby.config.js": Icon_Set["gatsby"],
// "gatsby-config.js": Icon_Set["gatsby"],
// "gatsby-node.js": Icon_Set["gatsby"],
// "gatsby-browser.js": Icon_Set["gatsby"],
// "gatsby-ssr.js": Icon_Set["gatsby"],
// ".wakatime-project": Icon_Set["wakatime"],
// "circle.yml": Icon_Set["circleci"],
// ".cfignore": Icon_Set["cloudfoundry"],
// "wallaby.js": Icon_Set["wallaby"],
// "wallaby.conf.js": Icon_Set["wallaby"],
// "stencil.config.js": Icon_Set["stencil"],
// "stencil.config.ts": Icon_Set["stencil"],
// ".bazelignore": Icon_Set["bazel"],
// ".bazelrc": Icon_Set["bazel"],
// "prisma.yml": Icon_Set["prisma"],
// ".nycrc": Icon_Set["istanbul"],
// ".nycrc.json": Icon_Set["istanbul"],
// "buildkite.yml": Icon_Set["buildkite"],
// "buildkite.yaml": Icon_Set["buildkite"],
// "netlify.json": Icon_Set["netlify"],
// "netlify.yml": Icon_Set["netlify"],
// "netlify.yaml": Icon_Set["netlify"],
// "netlify.toml": Icon_Set["netlify"],
// "nest-cli.json": Icon_Set["nest"],
// ".nest-cli.json": Icon_Set["nest"],
// "nestconfig.json": Icon_Set["nest"],
// ".nestconfig.json": Icon_Set["nest"],
// ".percy.yml": Icon_Set["percy"],
// ".gitpod.yml": Icon_Set["gitpod"],
// "tiltfile": Icon_Set["tilt"],
// "capacitor.config.json": Icon_Set["capacitor"],
// ".adonisrc.json": Icon_Set["adonis"],
// "ace": Icon_Set["adonis"],
// "meson.build": Icon_Set["meson"],
// ".buckconfig": Icon_Set["buck"],
// "nx.json": Icon_Set["nrwl"],
// ".slugignore": Icon_Set["slug"],
}
+359
View File
@@ -0,0 +1,359 @@
// assets contains all the Icon glyphs info
package assets
import "fmt"
// Icon_Info (icon information)
type Icon_Info struct {
i string
c [3]uint8 // represents the color in rgb (default 0,0,0 is black)
e bool // whether or not the file is executable [true = is executable]
}
func (i *Icon_Info) GetGlyph() string {
return i.i
}
func (i *Icon_Info) GetColor(f uint8) string {
if i.e {
return "\033[38;2;76;175;080m"
} else 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])
}
func (i *Icon_Info) MakeExe() {
i.e = true
}
var Icon_Set = map[string]*Icon_Info{
"html": {i: "\uf13b", c: [3]uint8{228, 79, 57}}, // html
"markdown": {i: "\uf853", c: [3]uint8{66, 165, 245}}, // markdown
"css": {i: "\uf81b", c: [3]uint8{66, 165, 245}}, // css
"css-map": {i: "\ue749", c: [3]uint8{66, 165, 245}}, // css-map
"sass": {i: "\ue603", c: [3]uint8{237, 80, 122}}, // sass
"less": {i: "\ue60b", c: [3]uint8{2, 119, 189}}, // less
"json": {i: "\ue60b", c: [3]uint8{251, 193, 60}}, // json
"yaml": {i: "\ue60b", c: [3]uint8{244, 68, 62}}, // yaml
"xml": {i: "\uf72d", c: [3]uint8{64, 153, 69}}, // xml
"image": {i: "\uf71e", c: [3]uint8{48, 166, 154}}, // image
"javascript": {i: "\ue74e", c: [3]uint8{255, 202, 61}}, // javascript
"javascript-map": {i: "\ue781", c: [3]uint8{255, 202, 61}}, // javascript-map
"test-jsx": {i: "\uf595", c: [3]uint8{35, 188, 212}}, // test-jsx
"test-js": {i: "\uf595", c: [3]uint8{255, 202, 61}}, // test-js
"react": {i: "\ue7ba", c: [3]uint8{35, 188, 212}}, // react
"react_ts": {i: "\ue7ba", c: [3]uint8{36, 142, 211}}, // react_ts
"settings": {i: "\uf013", c: [3]uint8{66, 165, 245}}, // settings
"typescript": {i: "\ue628", c: [3]uint8{3, 136, 209}}, // typescript
"typescript-def": {i: "\ufbe4", c: [3]uint8{3, 136, 209}}, // typescript-def
"test-ts": {i: "\uf595", c: [3]uint8{3, 136, 209}}, // test-ts
"pdf": {i: "\uf724", c: [3]uint8{244, 68, 62}}, // pdf
"table": {i: "\uf71a", c: [3]uint8{139, 195, 74}}, // table
"visualstudio": {i: "\ue70c", c: [3]uint8{173, 99, 188}}, // visualstudio
"database": {i: "\ue706", c: [3]uint8{255, 202, 61}}, // database
"mysql": {i: "\ue704", c: [3]uint8{1, 94, 134}}, // mysql
"postgresql": {i: "\ue76e", c: [3]uint8{49, 99, 140}}, // postgresql
"sqlite": {i: "\ue7c4", c: [3]uint8{1, 57, 84}}, // sqlite
"csharp": {i: "\uf81a", c: [3]uint8{2, 119, 189}}, // csharp
"zip": {i: "\uf410", c: [3]uint8{175, 180, 43}}, // zip
"exe": {i: "\uf2d0", c: [3]uint8{229, 77, 58}}, // exe
"java": {i: "\uf675", c: [3]uint8{244, 68, 62}}, // java
"c": {i: "\ufb70", c: [3]uint8{2, 119, 189}}, // c
"cpp": {i: "\ufb71", c: [3]uint8{2, 119, 189}}, // cpp
"go": {i: "\ufcd1", c: [3]uint8{32, 173, 194}}, // go
"go-mod": {i: "\ufcd1", c: [3]uint8{237, 80, 122}}, // go-mod
"go-test": {i: "\ufcd1", c: [3]uint8{255, 213, 79}}, // go-test
"python": {i: "\uf81f", c: [3]uint8{52, 102, 143}}, // python
"python-misc": {i: "\uf820", c: [3]uint8{130, 61, 28}}, // python-misc
"url": {i: "\uf836", c: [3]uint8{66, 165, 245}}, // url
"console": {i: "\uf68c", c: [3]uint8{250, 111, 66}}, // console
"word": {i: "\uf72b", c: [3]uint8{1, 87, 155}}, // word
"certificate": {i: "\uf623", c: [3]uint8{249, 89, 63}}, // certificate
"key": {i: "\uf805", c: [3]uint8{48, 166, 154}}, // key
"font": {i: "\uf031", c: [3]uint8{244, 68, 62}}, // font
"lib": {i: "\uf831", c: [3]uint8{139, 195, 74}}, // lib
"ruby": {i: "\ue739", c: [3]uint8{229, 61, 58}}, // ruby
"gemfile": {i: "\ue21e", c: [3]uint8{229, 61, 58}}, // gemfile
"fsharp": {i: "\ue7a7", c: [3]uint8{55, 139, 186}}, // fsharp
"swift": {i: "\ufbe3", c: [3]uint8{249, 95, 63}}, // swift
"docker": {i: "\uf308", c: [3]uint8{1, 135, 201}}, // docker
"powerpoint": {i: "\uf726", c: [3]uint8{209, 71, 51}}, // powerpoint
"video": {i: "\uf72a", c: [3]uint8{253, 154, 62}}, // video
"virtual": {i: "\uf822", c: [3]uint8{3, 155, 229}}, // virtual
"email": {i: "\uf6ed", c: [3]uint8{66, 165, 245}}, // email
"audio": {i: "\ufb75", c: [3]uint8{239, 83, 80}}, // audio
"coffee": {i: "\uf675", c: [3]uint8{66, 165, 245}}, // coffee
"document": {i: "\uf718", c: [3]uint8{66, 165, 245}}, // document
"rust": {i: "\ue7a8", c: [3]uint8{250, 111, 66}}, // rust
"raml": {i: "\ue60b", c: [3]uint8{66, 165, 245}}, // raml
"xaml": {i: "\ufb72", c: [3]uint8{66, 165, 245}}, // xaml
"haskell": {i: "\ue61f", c: [3]uint8{254, 168, 62}}, // haskell
"git": {i: "\ue702", c: [3]uint8{229, 77, 58}}, // git
"lua": {i: "\ue620", c: [3]uint8{66, 165, 245}}, // lua
"clojure": {i: "\ue76a", c: [3]uint8{100, 221, 23}}, // clojure
"groovy": {i: "\uf2a6", c: [3]uint8{41, 198, 218}}, // groovy
"r": {i: "\ufcd2", c: [3]uint8{25, 118, 210}}, // r
"dart": {i: "\ue798", c: [3]uint8{87, 182, 240}}, // dart
"mxml": {i: "\uf72d", c: [3]uint8{254, 168, 62}}, // mxml
"assembly": {i: "\uf471", c: [3]uint8{250, 109, 63}}, // assembly
"vue": {i: "\ufd42", c: [3]uint8{65, 184, 131}}, // vue
"vue-config": {i: "\ufd42", c: [3]uint8{58, 121, 110}}, // vue-config
"lock": {i: "\uf83d", c: [3]uint8{255, 213, 79}}, // lock
"handlebars": {i: "\ue60f", c: [3]uint8{250, 111, 66}}, // handlebars
"perl": {i: "\ue769", c: [3]uint8{149, 117, 205}}, // perl
"elixir": {i: "\ue62d", c: [3]uint8{149, 117, 205}}, // elixir
"erlang": {i: "\ue7b1", c: [3]uint8{244, 68, 62}}, // erlang
"twig": {i: "\ue61c", c: [3]uint8{155, 185, 47}}, // twig
"julia": {i: "\ue624", c: [3]uint8{134, 82, 159}}, // julia
"elm": {i: "\ue62c", c: [3]uint8{96, 181, 204}}, // elm
"smarty": {i: "\uf834", c: [3]uint8{255, 207, 60}}, // smarty
"stylus": {i: "\ue600", c: [3]uint8{192, 202, 51}}, // stylus
"verilog": {i: "\ufb19", c: [3]uint8{250, 111, 66}}, // verilog
"robot": {i: "\ufba7", c: [3]uint8{249, 89, 63}}, // robot
"solidity": {i: "\ufcb9", c: [3]uint8{3, 136, 209}}, // solidity
"yang": {i: "\ufb7e", c: [3]uint8{66, 165, 245}}, // yang
"vercel": {i: "\uf47e", c: [3]uint8{207, 216, 220}}, // vercel
"applescript": {i: "\uf302", c: [3]uint8{120, 144, 156}}, // applescript
"cake": {i: "\uf5ea", c: [3]uint8{250, 111, 66}}, // cake
"nim": {i: "\uf6a4", c: [3]uint8{255, 202, 61}}, // nim
"todo": {i: "\uf058", c: [3]uint8{124, 179, 66}}, // todo
"nix": {i: "\uf313", c: [3]uint8{80, 117, 193}}, // nix
"http": {i: "\uf484", c: [3]uint8{66, 165, 245}}, // http
"webpack": {i: "\ufc29", c: [3]uint8{142, 214, 251}}, // webpack
"ionic": {i: "\ue7a9", c: [3]uint8{79, 143, 247}}, // ionic
"gulp": {i: "\ue763", c: [3]uint8{229, 61, 58}}, // gulp
"nodejs": {i: "\uf898", c: [3]uint8{139, 195, 74}}, // nodejs
"npm": {i: "\ue71e", c: [3]uint8{203, 56, 55}}, // npm
"yarn": {i: "\uf61a", c: [3]uint8{44, 142, 187}}, // yarn
"android": {i: "\uf531", c: [3]uint8{139, 195, 74}}, // android
"tune": {i: "\ufb69", c: [3]uint8{251, 193, 60}}, // tune
"contributing": {i: "\uf64d", c: [3]uint8{255, 202, 61}}, // contributing
"readme": {i: "\uf7fb", c: [3]uint8{66, 165, 245}}, // readme
"changelog": {i: "\ufba6", c: [3]uint8{139, 195, 74}}, // changelog
"credits": {i: "\uf75f", c: [3]uint8{156, 204, 101}}, // credits
"authors": {i: "\uf0c0", c: [3]uint8{244, 68, 62}}, // authors
"favicon": {i: "\ue623", c: [3]uint8{255, 213, 79}}, // favicon
"karma": {i: "\ue622", c: [3]uint8{60, 190, 174}}, // karma
"travis": {i: "\ue77e", c: [3]uint8{203, 58, 73}}, // travis
"heroku": {i: "\ue607", c: [3]uint8{105, 99, 185}}, // heroku
"gitlab": {i: "\uf296", c: [3]uint8{226, 69, 57}}, // gitlab
"bower": {i: "\ue61a", c: [3]uint8{239, 88, 60}}, // bower
"conduct": {i: "\uf64b", c: [3]uint8{205, 220, 57}}, // conduct
"jenkins": {i: "\ue767", c: [3]uint8{240, 214, 183}}, // jenkins
"code-climate": {i: "\uf7f4", c: [3]uint8{238, 238, 238}}, // code-climate
"log": {i: "\uf719", c: [3]uint8{175, 180, 43}}, // log
"ejs": {i: "\ue618", c: [3]uint8{255, 202, 61}}, // ejs
"grunt": {i: "\ue611", c: [3]uint8{251, 170, 61}}, // grunt
"django": {i: "\ue71d", c: [3]uint8{67, 160, 71}}, // django
"makefile": {i: "\uf728", c: [3]uint8{239, 83, 80}}, // makefile
"bitbucket": {i: "\uf171", c: [3]uint8{31, 136, 229}}, // bitbucket
"d": {i: "\ue7af", c: [3]uint8{244, 68, 62}}, // d
"mdx": {i: "\uf853", c: [3]uint8{255, 202, 61}}, // mdx
"azure-pipelines": {i: "\uf427", c: [3]uint8{20, 101, 192}}, // azure-pipelines
"azure": {i: "\ufd03", c: [3]uint8{31, 136, 229}}, // azure
"razor": {i: "\uf564", c: [3]uint8{66, 165, 245}}, // razor
"asciidoc": {i: "\uf718", c: [3]uint8{244, 68, 62}}, // asciidoc
"edge": {i: "\uf564", c: [3]uint8{239, 111, 60}}, // edge
"scheme": {i: "\ufb26", c: [3]uint8{244, 68, 62}}, // scheme
"3d": {i: "\ue79b", c: [3]uint8{40, 182, 246}}, // 3d
"svg": {i: "\ufc1f", c: [3]uint8{255, 181, 62}}, // svg
"vim": {i: "\ue62b", c: [3]uint8{67, 160, 71}}, // vim
"moonscript": {i: "\uf186", c: [3]uint8{251, 193, 60}}, // moonscript
"codeowners": {i: "\uf507", c: [3]uint8{175, 180, 43}}, // codeowners
"disc": {i: "\ue271", c: [3]uint8{176, 190, 197}}, // disc
"fortran": {i: "F", c: [3]uint8{250, 111, 66}}, // fortran
"tcl": {i: "\ufbd1", c: [3]uint8{239, 83, 80}}, // tcl
"liquid": {i: "\ue275", c: [3]uint8{40, 182, 246}}, // liquid
"prolog": {i: "\ue7a1", c: [3]uint8{239, 83, 80}}, // prolog
"husky": {i: "\uf8e8", c: [3]uint8{229, 229, 229}}, // husky
"coconut": {i: "\uf5d2", c: [3]uint8{141, 110, 99}}, // coconut
"sketch": {i: "\uf6c7", c: [3]uint8{255, 194, 61}}, // sketch
"pawn": {i: "\ue261", c: [3]uint8{239, 111, 60}}, // pawn
"commitlint": {i: "\ufc16", c: [3]uint8{43, 150, 137}}, // commitlint
"dhall": {i: "\uf448", c: [3]uint8{120, 144, 156}}, // dhall
"dune": {i: "\uf7f4", c: [3]uint8{244, 127, 61}}, // dune
"shaderlab": {i: "\ufbad", c: [3]uint8{25, 118, 210}}, // shaderlab
"command": {i: "\ufb32", c: [3]uint8{175, 188, 194}}, // command
"stryker": {i: "\uf05b", c: [3]uint8{239, 83, 80}}, // stryker
"modernizr": {i: "\ue720", c: [3]uint8{234, 72, 99}}, // modernizr
"roadmap": {i: "\ufb6d", c: [3]uint8{48, 166, 154}}, // roadmap
"debian": {i: "\uf306", c: [3]uint8{211, 61, 76}}, // debian
"ubuntu": {i: "\uf31c", c: [3]uint8{214, 73, 53}}, // ubuntu
"arch": {i: "\uf303", c: [3]uint8{33, 142, 202}}, // arch
"redhat": {i: "\uf316", c: [3]uint8{231, 61, 58}}, // redhat
"gentoo": {i: "\uf30d", c: [3]uint8{148, 141, 211}}, // gentoo
"linux": {i: "\ue712", c: [3]uint8{238, 207, 55}}, // linux
"raspberry-pi": {i: "\uf315", c: [3]uint8{208, 60, 76}}, // raspberry-pi
"manjaro": {i: "\uf312", c: [3]uint8{73, 185, 90}}, // manjaro
"opensuse": {i: "\uf314", c: [3]uint8{111, 180, 36}}, // opensuse
"fedora": {i: "\uf30a", c: [3]uint8{52, 103, 172}}, // fedora
"freebsd": {i: "\uf30c", c: [3]uint8{175, 44, 42}}, // freebsd
"centOS": {i: "\uf304", c: [3]uint8{157, 83, 135}}, // centOS
"alpine": {i: "\uf300", c: [3]uint8{14, 87, 123}}, // alpine
"mint": {i: "\uf30f", c: [3]uint8{125, 190, 58}}, // mint
"routing": {i: "\ufb40", c: [3]uint8{67, 160, 71}}, // routing
"laravel": {i: "\ue73f", c: [3]uint8{248, 80, 81}}, // laravel
"pug": {i: "\ue60e", c: [3]uint8{239, 204, 163}}, // pug (Not supported by nerdFont)
"blink": {i: "\uf72a", c: [3]uint8{249, 169, 60}}, // blink (The Foundry Nuke) (Not supported by nerdFont)
"postcss": {i: "\uf81b", c: [3]uint8{244, 68, 62}}, // postcss (Not supported by nerdFont)
"jinja": {i: "\ue000", c: [3]uint8{174, 44, 42}}, // jinja (Not supported by nerdFont)
"sublime": {i: "\ue7aa", c: [3]uint8{239, 148, 58}}, // sublime (Not supported by nerdFont)
"markojs": {i: "\uf13b", c: [3]uint8{2, 119, 189}}, // markojs (Not supported by nerdFont)
"vscode": {i: "\ue70c", c: [3]uint8{33, 150, 243}}, // vscode (Not supported by nerdFont)
"qsharp": {i: "\uf292", c: [3]uint8{251, 193, 60}}, // qsharp (Not supported by nerdFont)
"vala": {i: "\uf7ab", c: [3]uint8{149, 117, 205}}, // vala (Not supported by nerdFont)
"zig": {i: "Z", c: [3]uint8{249, 169, 60}}, // zig (Not supported by nerdFont)
"h": {i: "h", c: [3]uint8{2, 119, 189}}, // h (Not supported by nerdFont)
"hpp": {i: "h", c: [3]uint8{2, 119, 189}}, // hpp (Not supported by nerdFont)
"powershell": {i: "\ufcb5", c: [3]uint8{5, 169, 244}}, // powershell (Not supported by nerdFont)
"gradle": {i: "\ufcc4", c: [3]uint8{29, 151, 167}}, // gradle (Not supported by nerdFont)
"arduino": {i: "\ue255", c: [3]uint8{35, 151, 156}}, // arduino (Not supported by nerdFont)
"tex": {i: "\uf783", c: [3]uint8{66, 165, 245}}, // tex (Not supported by nerdFont)
"graphql": {i: "\ue284", c: [3]uint8{237, 80, 122}}, // graphql (Not supported by nerdFont)
"kotlin": {i: "\ue70e", c: [3]uint8{139, 195, 74}}, // kotlin (Not supported by nerdFont)
"actionscript": {i: "\ufb25", c: [3]uint8{244, 68, 62}}, // actionscript (Not supported by nerdFont)
"autohotkey": {i: "\uf812", c: [3]uint8{76, 175, 80}}, // autohotkey (Not supported by nerdFont)
"flash": {i: "\uf740", c: [3]uint8{198, 52, 54}}, // flash (Not supported by nerdFont)
"swc": {i: "\ufbd3", c: [3]uint8{198, 52, 54}}, // swc (Not supported by nerdFont)
"cmake": {i: "\uf425", c: [3]uint8{178, 178, 179}}, // cmake (Not supported by nerdFont)
"nuxt": {i: "\ue2a6", c: [3]uint8{65, 184, 131}}, // nuxt (Not supported by nerdFont)
"ocaml": {i: "\uf1ce", c: [3]uint8{253, 154, 62}}, // ocaml (Not supported by nerdFont)
"haxe": {i: "\uf425", c: [3]uint8{246, 137, 61}}, // haxe (Not supported by nerdFont)
"puppet": {i: "\uf595", c: [3]uint8{251, 193, 60}}, // puppet (Not supported by nerdFont)
"purescript": {i: "\uf670", c: [3]uint8{66, 165, 245}}, // purescript (Not supported by nerdFont)
"merlin": {i: "\uf136", c: [3]uint8{66, 165, 245}}, // merlin (Not supported by nerdFont)
"mjml": {i: "\ue714", c: [3]uint8{249, 89, 63}}, // mjml (Not supported by nerdFont)
"terraform": {i: "\ue20f", c: [3]uint8{92, 107, 192}}, // terraform (Not supported by nerdFont)
"apiblueprint": {i: "\uf031", c: [3]uint8{66, 165, 245}}, // apiblueprint (Not supported by nerdFont)
"slim": {i: "\uf24e", c: [3]uint8{245, 129, 61}}, // slim (Not supported by nerdFont)
"babel": {i: "\uf5a0", c: [3]uint8{253, 217, 59}}, // babel (Not supported by nerdFont)
"codecov": {i: "\ue37c", c: [3]uint8{237, 80, 122}}, // codecov (Not supported by nerdFont)
"protractor": {i: "\uf288", c: [3]uint8{229, 61, 58}}, // protractor (Not supported by nerdFont)
"eslint": {i: "\ufbf6", c: [3]uint8{121, 134, 203}}, // eslint (Not supported by nerdFont)
"mocha": {i: "\uf6a9", c: [3]uint8{161, 136, 127}}, // mocha (Not supported by nerdFont)
"firebase": {i: "\ue787", c: [3]uint8{251, 193, 60}}, // firebase (Not supported by nerdFont)
"stylelint": {i: "\ufb76", c: [3]uint8{207, 216, 220}}, // stylelint (Not supported by nerdFont)
"prettier": {i: "\uf8e2", c: [3]uint8{86, 179, 180}}, // prettier (Not supported by nerdFont)
"jest": {i: "J", c: [3]uint8{244, 85, 62}}, // jest (Not supported by nerdFont)
"storybook": {i: "\ufd2c", c: [3]uint8{237, 80, 122}}, // storybook (Not supported by nerdFont)
"fastlane": {i: "\ufbff", c: [3]uint8{149, 119, 232}}, // fastlane (Not supported by nerdFont)
"helm": {i: "\ufd31", c: [3]uint8{32, 173, 194}}, // helm (Not supported by nerdFont)
"i18n": {i: "\uf7be", c: [3]uint8{121, 134, 203}}, // i18n (Not supported by nerdFont)
"semantic-release": {i: "\uf70f", c: [3]uint8{245, 245, 245}}, // semantic-release (Not supported by nerdFont)
"godot": {i: "\ufba7", c: [3]uint8{79, 195, 247}}, // godot (Not supported by nerdFont)
"godot-assets": {i: "\ufba7", c: [3]uint8{129, 199, 132}}, // godot-assets (Not supported by nerdFont)
"vagrant": {i: "\uf27d", c: [3]uint8{20, 101, 192}}, // vagrant (Not supported by nerdFont)
"tailwindcss": {i: "\ufc8b", c: [3]uint8{77, 182, 172}}, // tailwindcss (Not supported by nerdFont)
"gcp": {i: "\uf662", c: [3]uint8{70, 136, 250}}, // gcp (Not supported by nerdFont)
"opam": {i: "\uf1ce", c: [3]uint8{255, 213, 79}}, // opam (Not supported by nerdFont)
"pascal": {i: "\uf8da", c: [3]uint8{3, 136, 209}}, // pascal (Not supported by nerdFont)
"nuget": {i: "\ue77f", c: [3]uint8{3, 136, 209}}, // nuget (Not supported by nerdFont)
"denizenscript": {i: "D", c: [3]uint8{255, 213, 79}}, // denizenscript (Not supported by nerdFont)
// "riot": {i:"\u", c:[3]uint8{255, 255, 255}}, // riot
// "autoit": {i:"\u", c:[3]uint8{255, 255, 255}}, // autoit
// "livescript": {i:"\u", c:[3]uint8{255, 255, 255}}, // livescript
// "reason": {i:"\u", c:[3]uint8{255, 255, 255}}, // reason
// "bucklescript": {i:"\u", c:[3]uint8{255, 255, 255}}, // bucklescript
// "mathematica": {i:"\u", c:[3]uint8{255, 255, 255}}, // mathematica
// "wolframlanguage": {i:"\u", c:[3]uint8{255, 255, 255}}, // wolframlanguage
// "nunjucks": {i:"\u", c:[3]uint8{255, 255, 255}}, // nunjucks
// "haml": {i:"\u", c:[3]uint8{255, 255, 255}}, // haml
// "cucumber": {i:"\u", c:[3]uint8{255, 255, 255}}, // cucumber
// "vfl": {i:"\u", c:[3]uint8{255, 255, 255}}, // vfl
// "kl": {i:"\u", c:[3]uint8{255, 255, 255}}, // kl
// "coldfusion": {i:"\u", c:[3]uint8{255, 255, 255}}, // coldfusion
// "cabal": {i:"\u", c:[3]uint8{255, 255, 255}}, // cabal
// "restql": {i:"\u", c:[3]uint8{255, 255, 255}}, // restql
// "kivy": {i:"\u", c:[3]uint8{255, 255, 255}}, // kivy
// "graphcool": {i:"\u", c:[3]uint8{255, 255, 255}}, // graphcool
// "sbt": {i:"\u", c:[3]uint8{255, 255, 255}}, // sbt
// "flow": {i:"\u", c:[3]uint8{255, 255, 255}}, // flow
// "bithound": {i:"\u", c:[3]uint8{255, 255, 255}}, // bithound
// "appveyor": {i:"\u", c:[3]uint8{255, 255, 255}}, // appveyor
// "fusebox": {i:"\u", c:[3]uint8{255, 255, 255}}, // fusebox
// "editorconfig": {i:"\u", c:[3]uint8{255, 255, 255}}, // editorconfig
// "watchman": {i:"\u", c:[3]uint8{255, 255, 255}}, // watchman
// "aurelia": {i:"\u", c:[3]uint8{255, 255, 255}}, // aurelia
// "rollup": {i:"\u", c:[3]uint8{255, 255, 255}}, // rollup
// "hack": {i:"\u", c:[3]uint8{255, 255, 255}}, // hack
// "apollo": {i:"\u", c:[3]uint8{255, 255, 255}}, // apollo
// "nodemon": {i:"\u", c:[3]uint8{255, 255, 255}}, // nodemon
// "webhint": {i:"\u", c:[3]uint8{255, 255, 255}}, // webhint
// "browserlist": {i:"\u", c:[3]uint8{255, 255, 255}}, // browserlist
// "crystal": {i:"\u", c:[3]uint8{255, 255, 255}}, // crystal
// "snyk": {i:"\u", c:[3]uint8{255, 255, 255}}, // snyk
// "drone": {i:"\u", c:[3]uint8{255, 255, 255}}, // drone
// "cuda": {i:"\u", c:[3]uint8{255, 255, 255}}, // cuda
// "dotjs": {i:"\u", c:[3]uint8{255, 255, 255}}, // dotjs
// "sequelize": {i:"\u", c:[3]uint8{255, 255, 255}}, // sequelize
// "gatsby": {i:"\u", c:[3]uint8{255, 255, 255}}, // gatsby
// "wakatime": {i:"\u", c:[3]uint8{255, 255, 255}}, // wakatime
// "circleci": {i:"\u", c:[3]uint8{255, 255, 255}}, // circleci
// "cloudfoundry": {i:"\u", c:[3]uint8{255, 255, 255}}, // cloudfoundry
// "processing": {i:"\u", c:[3]uint8{255, 255, 255}}, // processing
// "wepy": {i:"\u", c:[3]uint8{255, 255, 255}}, // wepy
// "hcl": {i:"\u", c:[3]uint8{255, 255, 255}}, // hcl
// "san": {i:"\u", c:[3]uint8{255, 255, 255}}, // san
// "wallaby": {i:"\u", c:[3]uint8{255, 255, 255}}, // wallaby
// "stencil": {i:"\u", c:[3]uint8{255, 255, 255}}, // stencil
// "red": {i:"\u", c:[3]uint8{255, 255, 255}}, // red
// "webassembly": {i:"\u", c:[3]uint8{255, 255, 255}}, // webassembly
// "foxpro": {i:"\u", c:[3]uint8{255, 255, 255}}, // foxpro
// "jupyter": {i:"\u", c:[3]uint8{255, 255, 255}}, // jupyter
// "ballerina": {i:"\u", c:[3]uint8{255, 255, 255}}, // ballerina
// "racket": {i:"\u", c:[3]uint8{255, 255, 255}}, // racket
// "bazel": {i:"\u", c:[3]uint8{255, 255, 255}}, // bazel
// "mint": {i:"\u", c:[3]uint8{255, 255, 255}}, // mint
// "velocity": {i:"\u", c:[3]uint8{255, 255, 255}}, // velocity
// "prisma": {i:"\u", c:[3]uint8{255, 255, 255}}, // prisma
// "abc": {i:"\u", c:[3]uint8{255, 255, 255}}, // abc
// "istanbul": {i:"\u", c:[3]uint8{255, 255, 255}}, // istanbul
// "lisp": {i:"\u", c:[3]uint8{255, 255, 255}}, // lisp
// "buildkite": {i:"\u", c:[3]uint8{255, 255, 255}}, // buildkite
// "netlify": {i:"\u", c:[3]uint8{255, 255, 255}}, // netlify
// "svelte": {i:"\u", c:[3]uint8{255, 255, 255}}, // svelte
// "nest": {i:"\u", c:[3]uint8{255, 255, 255}}, // nest
// "percy": {i:"\u", c:[3]uint8{255, 255, 255}}, // percy
// "gitpod": {i:"\u", c:[3]uint8{255, 255, 255}}, // gitpod
// "advpl_prw": {i:"\u", c:[3]uint8{255, 255, 255}}, // advpl_prw
// "advpl_ptm": {i:"\u", c:[3]uint8{255, 255, 255}}, // advpl_ptm
// "advpl_tlpp": {i:"\u", c:[3]uint8{255, 255, 255}}, // advpl_tlpp
// "advpl_include": {i:"\u", c:[3]uint8{255, 255, 255}}, // advpl_include
// "tilt": {i:"\u", c:[3]uint8{255, 255, 255}}, // tilt
// "capacitor": {i:"\u", c:[3]uint8{255, 255, 255}}, // capacitor
// "adonis": {i:"\u", c:[3]uint8{255, 255, 255}}, // adonis
// "forth": {i:"\u", c:[3]uint8{255, 255, 255}}, // forth
// "uml": {i:"\u", c:[3]uint8{255, 255, 255}}, // uml
// "meson": {i:"\u", c:[3]uint8{255, 255, 255}}, // meson
// "buck": {i:"\u", c:[3]uint8{255, 255, 255}}, // buck
// "sml": {i:"\u", c:[3]uint8{255, 255, 255}}, // sml
// "nrwl": {i:"\u", c:[3]uint8{255, 255, 255}}, // nrwl
// "imba": {i:"\u", c:[3]uint8{255, 255, 255}}, // imba
// "drawio": {i:"\u", c:[3]uint8{255, 255, 255}}, // drawio
// "sas": {i:"\u", c:[3]uint8{255, 255, 255}}, // sas
// "slug": {i:"\u", c:[3]uint8{255, 255, 255}}, // slug
"dir-config": {i: "\ue5fc", c: [3]uint8{32, 173, 194}}, // dir-config
"dir-controller": {i: "\ue5fc", c: [3]uint8{255, 194, 61}}, // dir-controller
"dir-git": {i: "\ue5fb", c: [3]uint8{250, 111, 66}}, // dir-git
"dir-github": {i: "\ue5fd", c: [3]uint8{84, 110, 122}}, // dir-github
"dir-npm": {i: "\ue5fa", c: [3]uint8{203, 56, 55}}, // dir-npm
"dir-include": {i: "\uf756", c: [3]uint8{3, 155, 229}}, // dir-include
"dir-import": {i: "\uf756", c: [3]uint8{175, 180, 43}}, // dir-import
"dir-upload": {i: "\uf758", c: [3]uint8{250, 111, 66}}, // dir-upload
"dir-download": {i: "\uf74c", c: [3]uint8{76, 175, 80}}, // dir-download
"dir-secure": {i: "\uf74f", c: [3]uint8{249, 169, 60}}, // dir-secure
"dir-images": {i: "\uf74e", c: [3]uint8{43, 150, 137}}, // dir-images
"dir-environment": {i: "\uf74e", c: [3]uint8{102, 187, 106}}, // dir-environment
}
// default icons in case nothing can be found
var Icon_Def = map[string]*Icon_Info{
"dir": {i: "\uf74a", c: [3]uint8{224, 177, 77}},
"diropen": {i: "\ufc6e", c: [3]uint8{224, 177, 77}},
"hiddendir": {i: "\uf755", c: [3]uint8{224, 177, 77}},
"exe": {i: "\uf713", c: [3]uint8{76, 175, 80}},
"file": {i: "\uf723", c: [3]uint8{65, 129, 190}},
"hiddenfile": {i: "\ufb12", c: [3]uint8{65, 129, 190}},
}
+47
View File
@@ -0,0 +1,47 @@
package assets
var Icon_SubExt = map[string]*Icon_Info{
"routing.ts": Icon_Set["routing"],
"routing.tsx": Icon_Set["routing"],
"routing.js": Icon_Set["routing"],
"routing.jsx": Icon_Set["routing"],
"routes.ts": Icon_Set["routing"],
"routes.tsx": Icon_Set["routing"],
"routes.js": Icon_Set["routing"],
"routes.jsx": Icon_Set["routing"],
"sln.dotsettings": Icon_Set["settings"],
"d.ts": Icon_Set["typescript-def"],
"vcxitems.filters": Icon_Set["visualstudio"],
"vcxproj.filters": Icon_Set["visualstudio"],
"js.map": Icon_Set["javascript-map"],
"mjs.map": Icon_Set["javascript-map"],
"css.map": Icon_Set["css-map"],
"spec.ts": Icon_Set["test-ts"],
"e2e-spec.ts": Icon_Set["test-ts"],
"test.ts": Icon_Set["test-ts"],
"ts.snap": Icon_Set["test-ts"],
"spec.tsx": Icon_Set["test-jsx"],
"test.tsx": Icon_Set["test-jsx"],
"tsx.snap": Icon_Set["test-jsx"],
"spec.jsx": Icon_Set["test-jsx"],
"test.jsx": Icon_Set["test-jsx"],
"jsx.snap": Icon_Set["test-jsx"],
"spec.js": Icon_Set["test-js"],
"e2e-spec.js": Icon_Set["test-js"],
"test.js": Icon_Set["test-js"],
"js.snap": Icon_Set["test-js"],
"tf.json": Icon_Set["terraform"],
"blade.php": Icon_Set["laravel"],
"inky.php": Icon_Set["laravel"],
"gitlab-ci.yml": Icon_Set["gitlab"],
"stories.js": Icon_Set["storybook"],
"stories.jsx": Icon_Set["storybook"],
"story.js": Icon_Set["storybook"],
"story.jsx": Icon_Set["storybook"],
"stories.ts": Icon_Set["storybook"],
"stories.tsx": Icon_Set["storybook"],
"story.ts": Icon_Set["storybook"],
"story.tsx": Icon_Set["storybook"],
"azure-pipelines.yml": Icon_Set["azure-pipelines"],
"azure-pipelines.yaml": Icon_Set["azure-pipelines"],
}
+93
View File
@@ -0,0 +1,93 @@
package assets_test
import (
"bytes"
"fmt"
"io"
"log"
"os"
"sort"
"testing"
"github.com/Yash-Handa/logo-ls/assets"
"github.com/Yash-Handa/logo-ls/internal/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
terminalWidth, _, e := terminal.GetSize(int(os.Stdout.Fd()))
if e != nil {
terminalWidth = 80
}
ks := make([]string, 0)
for k := range assets.Icon_Set {
ks = append(ks, k)
}
sort.Strings(ks)
for _, v := range ks {
t.Run("Testing icon: "+v, func(st *testing.T) {
i := assets.Icon_Set[v]
fmt.Fprintln(os.Stderr)
buf := bytes.NewBuffer([]byte(""))
log.Println("Printing files of type", i.GetColor(1)+v+"\033[0m")
w := ctw.New(terminalWidth)
for f, d := range assets.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[0m")
w = ctw.New(terminalWidth)
for e, d := range assets.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
terminalWidth, _, e := terminal.GetSize(int(os.Stdout.Fd()))
if e != nil {
terminalWidth = 80
}
temp := [2]map[string]*assets.Icon_Info{assets.Icon_Set, assets.Icon_Def}
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)
})
}
}
+86
View File
@@ -0,0 +1,86 @@
# The below list of icons are not included as are not currently supported by nerd fonts, If you are interested consider opening PRs on Nerd Fonts repo
icons:
- riot
- autoit
- livescript
- reason
- bucklescript
- mathematica
- wolframlanguage
- nunjucks
- haml
- cucumber
- vfl
- kl
- coldfusion
- cabal
- restql
- kivy
- graphcool
- sbt
- flow
- bithound
- appveyor
- fusebox
- editorconfig
- watchman
- aurelia
- rollup
- hack
- apollo
- nodemon
- webhint
- browserlist
- crystal
- snyk
- drone
- cuda
- dotjs
- sequelize
- gatsby
- wakatime
- circleci
- cloudfoundry
- processing
- wepy
- hcl
- san
- wallaby
- stencil
- red
- webassembly
- foxpro
- jupyter
- ballerina
- racket
- bazel
- mint
- velocity
- prisma
- abc
- istanbul
- lisp
- buildkite
- netlify
- svelte
- nest
- percy
- gitpod
- advpl_prw
- advpl_ptm
- advpl_tlpp
- advpl_include
- tilt
- capacitor
- adonis
- forth
- uml
- meson
- buck
- sml
- nrwl
- imba
- drawio
- sas
- slug
-106
View File
@@ -1,106 +0,0 @@
// custom/ in-house implementation of go's tab-writer
// because ls shows table in column major fation and according to screen size
package ctw
import (
"bytes"
"fmt"
"math"
)
func widthsSum(w []int, p int) int {
s := 0
for _, v := range w {
s += v + p
}
s -= p
return s
}
func findMax(arr []int) int {
max := 0
for _, v := range arr {
if v >= max {
max = v
}
}
return max
}
//Ctw has complexity of no. of columns x no. of files
// termW is width of the terminal
func Ctw(buf *bytes.Buffer, data []string, termW int) {
dn := len(data) // length of data slice
if dn == 0 {
return
}
const pad = 2 // padding b/w columns
var lens []int // slice of lengths of each element in the data slice
widths := make([]int, 0) // slice of widths of each column (don't use because it over run once)
var prevWidths []int // accurate widths value
for _, v := range data {
lens = append(lens, len(v))
}
prevj := 0 // prevj is previous jump value (row value if you may)
// for loop runs for all possible nos. of column (1,2,3,4....)
for {
cols := len(widths) + 1
widths = append(widths, 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++ {
widths[i] = findMax(lens[b:e])
b, e = e, e+j
}
// for last column if last column is not complete
if e-j < dn {
widths[cols-1] = findMax(lens[e-j : dn])
}
prevj = j
totW := widthsSum(widths, pad) //total width of the ls block
if totW > termW {
break
} else if totW > termW/2 { // if total width of the ls block is more than half of terminal
// copy widths to prevWidths
prevWidths = make([]int, len(widths))
for i := range widths {
prevWidths[i] = widths[i]
}
}
if cols == dn { // if content comes in one line of terminal
// copy widths to prevWidths
prevWidths = make([]int, len(widths))
for i := range widths {
prevWidths[i] = widths[i]
}
break
}
}
// total no of rows
rows := int(math.Ceil(float64(dn) / float64(len(prevWidths))))
// loop to write entire ls block to buffer
for i := 0; i < rows; i++ {
for j := 0; j < len(prevWidths); j++ {
if i+j*rows >= dn { // checks for last column if incomplete
continue
}
fmt.Fprintf(buf, "%-*s", prevWidths[j]+pad, data[i+j*rows])
}
fmt.Fprintf(buf, "\n")
}
}
-257
View File
@@ -1,257 +0,0 @@
// this file contain dir type definition
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 {
name, ext, indicator string
modTime time.Time
size int64 // in bytes
mode string
modeBits uint32
owner, group string // use syscall package
blocks int64 // blocks required by the file multiply buy 512 to get block size
}
type dir struct {
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
func newDir(d *os.File) (*dir, error) {
// some flag variable combinations
var long, curDir, showHidden bool = flagVector&(flag_l|flag_o|flag_g) > 0, flagVector&(flag_a|flag_d) > 0, flagVector&(flag_a|flag_A) > 0
t := new(dir)
// filing current dir info
t.info = new(file)
t.info.name = "."
if curDir {
ds, err := d.Stat()
if err != nil {
return nil, err
}
t.info.size = ds.Size()
t.info.modTime = ds.ModTime()
if long {
t.info.mode = ds.Mode().String()
t.info.modeBits = uint32(ds.Mode())
t.info.owner, t.info.group = getOwnerGroupInfo(ds)
}
if flagVector&flag_s > 0 {
if s, ok := ds.Sys().(*syscall.Stat_t); ok {
t.info.blocks = s.Blocks
}
}
}
// don't fill files info if the -d flag is passed
if flagVector&flag_d > 0 {
t.files = append(t.files, t.info)
return t, nil
}
files, err := d.Readdir(0)
for _, v := range files {
name := v.Name()
if !showHidden && strings.HasPrefix(name, ".") {
continue
}
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
}
}
t.files = append(t.files, f)
if v.IsDir() {
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
}
}
t.files = append(t.files, t.parent)
}
// return *dir with no error
// or partial *dir with error (produced by Readdir)
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
}
}
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", 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
//sorting
lessFuncGenerator(d)
if flagVector&flag_U == 0 && flagVector&flag_r > 0 {
sort.Sort(sort.Reverse(d))
} else {
sort.Sort(d)
}
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"
for _, v := range d.files {
if flagVector&flag_s > 0 {
fmt.Fprintf(w, "%s\t", getSizeInFormate(v.blocks*512))
}
fmt.Fprintf(w, fmtStr, v.mode, v.owner, v.group, getSizeInFormate(v.size), v.modTime.Format(timeFormate), v.name+v.ext+v.indicator)
}
w.Flush()
case flagVector&flag_1 > 0:
w = tabwriter.NewWriter(buf, 0, 0, 1, ' ', tabwriter.DiscardEmptyColumns)
for _, v := range d.files {
if flagVector&flag_s > 0 {
fmt.Fprintf(w, "%s\t", getSizeInFormate(v.blocks*512))
}
fmt.Fprintf(w, "%s\t\n", v.name+v.ext+v.indicator)
}
w.Flush()
default:
// w = tabwriter.NewWriter(buf, 0, 0, 2, ' ', tabwriter.DiscardEmptyColumns)
temp := make([]string, len(d.files))
for i, v := range d.files {
s := ""
if flagVector&flag_s > 0 {
s = getSizeInFormate(v.blocks*512) + " "
}
temp[i] = s + v.name + v.ext + v.indicator
}
ctw.Ctw(buf, temp, terminalWidth)
}
return buf
}
// sorting functions
func (d *dir) Len() int {
return len(d.files)
}
func (d *dir) Swap(i, j int) {
d.files[i], d.files[j] = d.files[j], d.files[i]
}
func (d *dir) Less(i, j int) bool {
return d.less(i, j)
}
+127
View File
@@ -0,0 +1,127 @@
package main
import (
"bytes"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"testing"
)
type nodes []struct {
name string
textContent []byte
dirContent *nodes
}
func (n *nodes) create(t *testing.T, dir string) {
for _, f := range *n {
fn := filepath.Join(dir, f.name)
if f.textContent != nil {
if err := ioutil.WriteFile(fn, f.textContent, 0666); err != nil {
t.Fatal(err)
}
} else if f.dirContent != nil {
if err := os.Mkdir(fn, 0777); err != nil {
t.Log(err)
t.Fail()
continue
}
f.dirContent.create(t, fn)
}
}
}
func TestE2E(t *testing.T) {
goExec, err := exec.LookPath("go")
if err != nil {
t.Fatal(err)
}
dirEnv := filepath.Join("./testdata", "dirEnv")
os.RemoveAll(dirEnv)
// create a temp directory environment
if err := os.Mkdir(dirEnv, 0777); err != nil {
t.Fatal(err)
}
defer os.RemoveAll(dirEnv)
// if you update the fileStruct or create any changes that may break the snapshorts present in ./testdata/logo-ls*.txt
// then you do have to update the snapshorts like: logo-ls -V > ./testdata/logo-ls-V.txt
fileStruct := nodes{
{name: "1test.go", textContent: []byte("package main\nimport \"fmt\"\nfunc main() {\n fmt.Println(\"Hello\")\n}")},
{name: "2test.js", textContent: []byte("consol.log('Hello')")},
{name: "test.routes.tsx", textContent: []byte("consol.log('Hello')")},
{name: "Dockerfile", textContent: []byte("FROM golang:1.15.2-buster AS base")},
{name: "abc.css", textContent: []byte("h1 {\n color : red;\n}")},
{name: "abc.sass", textContent: []byte("h1 {\n color : red;\n}")},
{name: ".abc.txt", textContent: []byte("Hello")},
{name: "3test.py", textContent: []byte("print('Hello')")},
{name: "testDir", dirContent: &nodes{
{name: "abc.txt", textContent: []byte("Hello")},
{name: "1test.go", textContent: []byte("package main\nimport \"fmt\"\nfunc main() {\n fmt.Println(\"Hello\")\n}")},
{name: "2test.js", textContent: []byte("consol.log('Hello')")},
}},
{name: ".privateDir", dirContent: &nodes{
{name: "abc.txt", textContent: []byte("Hello")},
{name: "1test.go", textContent: []byte("package main\nimport \"fmt\"\nfunc main() {\n fmt.Println(\"Hello\")\n}")},
{name: "2test.js", textContent: []byte("consol.log('Hello')")},
}},
{name: "Downloads", dirContent: &nodes{}},
}
fileStruct.create(t, dirEnv)
tt := []struct {
args []string
testFile string
td string
}{
{args: []string{"-1"}, testFile: "logo-ls.snap", td: "Testing normal execution"},
{args: []string{"-1a"}, testFile: "logo-ls-a.snap", td: "Testing -a (all) execution"},
{args: []string{"-1A"}, testFile: "logo-ls-A.snap", td: "Testing -A (almost all) execution"},
{args: []string{"-1i"}, testFile: "logo-ls-i.snap", td: "Testing -i (no icon) execution"},
{args: []string{"-1r"}, testFile: "logo-ls-r.snap", td: "Testing -r (reverse) execution"},
{args: []string{"-1sh"}, testFile: "logo-ls-sh.snap", td: "Testing -sh (human readable size) execution"},
{args: []string{"-1R"}, testFile: "logo-ls-R.snap", td: "Testing -R (recursive) execution"},
{args: []string{"-1Ra"}, testFile: "logo-ls-Ra.snap", td: "Testing -Ra (recursive, all) execution"},
{args: []string{"-1shRa"}, testFile: "logo-ls-shRa.snap", td: "Testing -shRa execution"},
{args: []string{"-V"}, testFile: "logo-ls-V.snap", td: "Testing -V option prints version"},
{args: []string{"-?"}, testFile: "logo-ls--help.snap", td: "Testing -? (help) prints help message"},
}
for _, test := range tt {
t.Run(test.td, func(st *testing.T) {
args := []string{"run", "."}
args = append(args, test.args...)
cmd := exec.Command(goExec, append(args, dirEnv)...)
stdout, err := cmd.StdoutPipe()
defer stdout.Close()
if err != nil {
st.Fatal(err)
}
if err := cmd.Start(); err != nil {
st.Fatal(err)
}
cmdData, err := ioutil.ReadAll(stdout)
if err != nil {
st.Fatal(err)
}
if err := cmd.Wait(); err != nil {
st.Fatal(err)
}
fileData, err := ioutil.ReadFile(filepath.Join("./testdata", test.testFile))
if err != nil {
st.Fatal(err)
}
if bytes.Compare(cmdData, fileData) != 0 {
t.Fatalf("expected output of the command:\n-----------\n%s\n=============\nbut got:\n-----------\n%s", fileData, cmdData)
}
})
}
}
+9 -1
View File
@@ -3,6 +3,14 @@ module github.com/Yash-Handa/logo-ls
go 1.15
require (
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/go-git/go-git/v5 v5.2.0
github.com/imdario/mergo v0.3.11 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/mattn/go-colorable v0.1.7
github.com/pborman/getopt/v2 v2.0.0
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
github.com/xanzy/ssh-agent v0.3.0 // indirect
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/net v0.0.0-20201224014010-6772e930b67b // indirect
golang.org/x/sys v0.0.0-20201223074533-0d417f636930 // indirect
)
+112 -2
View File
@@ -1,10 +1,120 @@
github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
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.2-0.20200613231340-f56387b50c12 h1:PbKy9zOy4aAKrJ5pibIRpVO2BXnK1Tlcg+caKI7Ox5M=
github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw=
github.com/go-git/go-git/v5 v5.2.0 h1:YPBLG/3UK1we1ohRkncLjaXWLW+HKp5QNM/jTli2JgI=
github.com/go-git/go-git/v5 v5.2.0/go.mod h1:kh02eMX+wdqqxgNMEyq8YgwlIOsDOa9homkUq1PoTMs=
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/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
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/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck=
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
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/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw=
github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
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/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.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/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
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=
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
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-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
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/net v0.0.0-20201224014010-6772e930b67b h1:iFwSg7t5GZmB/Q5TjiEAsdoLDrdJRC1RiF2WhuV29Qw=
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
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-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/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/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201223074533-0d417f636930 h1:vRgIt+nup/B/BwIS0g2oC0haq0iqbV3ZA+u6+0TlNCo=
golang.org/x/sys v0.0.0-20201223074533-0d417f636930/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
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/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
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=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+265
View File
@@ -0,0 +1,265 @@
//This file contains the cli API and configs it
package api
import (
"fmt"
"log"
"os"
"strconv"
"time"
"github.com/Yash-Handa/logo-ls/internal/sysState"
"github.com/pborman/getopt/v2"
"golang.org/x/crypto/ssh/terminal"
)
// flags with corresponding bit values
// frequently used flags should be higher in the list
// help (-?) and version (-V) not included
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
Flag_X
Flag_s
Flag_v
Flag_U
Flag_1
Flag_d
Flag_o
Flag_g
Flag_G
)
// flagVector has all the options set in it. Each bit represent an option.
var FlagVector uint
// time formate
var timeFormate string
func TimeFormate(t string) {
timeFormate = t
}
func GetTimeFormate() string {
return timeFormate
}
var FileList []string
func Bootstrap() {
getopt.SetParameters("[files ...]")
// 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")
f_l := getopt.Bool('l', "use a long listing format")
f_o := getopt.Bool('o', "like -l, but do not list group information")
f_g := getopt.Bool('g', "\nlike -l, but do not list owner")
f_G := getopt.BoolLong("no-group", 'G', "in a long listing, don't print group names")
f_h := getopt.BoolLong("human-readable", 'h', "with -l and -s, print sizes like 1K 234M 2G etc.")
f_s := getopt.BoolLong("size", 's', "print the allocated size of each file, in blocks")
// sorting flags
f_S := getopt.Bool('S', "sort by file size, largest first")
f_U := getopt.Bool('U', "do not sort; list entries in directory order")
f_X := getopt.Bool('X', "sort alphabetically by entry extension")
f_v := getopt.Bool('v', "natural sort of (version) numbers within text")
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.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
err := getopt.Getopt(nil)
if err != nil {
// code to handle error
log.Printf("%v\nTry 'logo-ls -?' for more information.", err)
sysState.ExitCode(sysState.Code_Serious)
os.Exit(sysState.GetExitCode())
}
// list of files/ dir
FileList = getopt.Args()
// set one of -A and -a priority -A > -a
switch {
case *f_A:
FlagVector |= Flag_A
case *f_a:
FlagVector |= Flag_a
}
// set one of -S, -U, -X, -v, -t and alpha priority -S > -t > -X > -v > -U > alpha
switch {
case *f_S:
FlagVector |= Flag_S
case *f_t:
FlagVector |= Flag_t
case *f_X:
FlagVector |= Flag_X
case *f_v:
FlagVector |= Flag_v
case *f_U:
FlagVector |= Flag_U
default:
FlagVector |= Flag_alpha
}
// set reverse (-r) flag
if *f_r {
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
}
// set disable-icon (-i) flag
if *f_i {
FlagVector |= Flag_i
}
// set -1 flag
if *f_1 {
FlagVector |= Flag_1
}
// set -d flag
if *f_d {
FlagVector |= Flag_d
}
// set -G flag
if *f_G {
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
}
// set -s flag
if *f_s {
FlagVector |= Flag_s
}
// set one of -o, -g and -l priority -o > -g > -l
switch {
case *f_o:
FlagVector |= Flag_o
case *f_g:
FlagVector |= Flag_g
case *f_l:
FlagVector |= Flag_l
case *f_1:
default:
// screen width for custom tw
w, _, e := terminal.GetSize(int(os.Stdout.Fd()))
if e == nil {
if w == 0 {
// for systems that dont support TIOCGWINSZ.
w, _ = strconv.Atoi(os.Getenv("COLUMNS"))
}
sysState.TerminalWidth(w)
}
}
// 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)
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(sysState.GetExitCode())
}
// 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", "v1.3.7")
fmt.Println("\nWritten by Yash Handa")
os.Exit(sysState.GetExitCode())
}
}
+184
View File
@@ -0,0 +1,184 @@
// ctw is a custom tab writter package build to correctly display icons and colors for color-ls
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 {
// not even first iteration done print similar to logo-ls -1
if len(widths) == 0 {
widths = make([][4]int, len(iw))
for i := range iw {
widths[i] = iw[i]
}
}
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], noColor, brailEmpty)
}
fmt.Fprintf(buf, "%s%-*s%s", getGitColor(w.d[i][3]), cs[2], w.d[i][2], noColor)
if cs[3] > 0 {
fmt.Fprintf(buf, "%s%s%1s%s", brailEmpty, getGitColor(w.d[i][3]), w.d[i][3], noColor)
}
}
+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, noColor)
} 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, noColor)
} 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 (
noColor string = "\033[0m"
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 {
noColor = ""
green = ""
brown = ""
}
}
func DisplayBrailEmpty(b bool) {
if b == false {
brailEmpty = " "
}
}
func getGitColor(gitStatus string) string {
switch strings.Trim(gitStatus, " ") {
case "":
return noColor
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
}
+310
View File
@@ -0,0 +1,310 @@
// this file contain dir type definition
package dir
import (
"bytes"
"fmt"
"io"
"log"
"os"
"path/filepath"
"runtime"
"sort"
"strings"
"time"
"github.com/Yash-Handa/logo-ls/assets"
"github.com/Yash-Handa/logo-ls/internal/api"
"github.com/Yash-Handa/logo-ls/internal/ctw"
"github.com/Yash-Handa/logo-ls/internal/sysState"
"github.com/mattn/go-colorable"
)
// create the open dir icon
var OpenDirIcon = assets.Icon_Def["diropen"].GetColor(1) + assets.Icon_Def["diropen"].GetGlyph() + "\033[0m" + " "
type file struct {
name, ext, indicator string
modTime time.Time
size int64 // in bytes
mode string
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
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
func New(d *os.File) (*dir, error) {
// some flag variable combinations
var long, curDir, showHidden bool = api.FlagVector&(api.Flag_l|api.Flag_o|api.Flag_g) > 0, api.FlagVector&(api.Flag_a|api.Flag_d) > 0, api.FlagVector&(api.Flag_a|api.Flag_A) > 0
t := new(dir)
// filing current dir info
t.info = new(file)
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 api.FlagVector&api.Flag_D > 0 {
gitRepoStatus = getFilesGitStatus(d.Name()) // returns map or nil
if len(gitRepoStatus) == 0 {
gitRepoStatus = nil
}
}
if curDir {
t.info.size = ds.Size()
t.info.modTime = ds.ModTime()
if long {
t.info.mode = ds.Mode().String()
t.info.modeBits = uint32(ds.Mode())
t.info.owner, t.info.group = getOwnerGroupInfo(ds)
}
if api.FlagVector&api.Flag_s > 0 {
dirBlocks(t.info, ds)
}
if api.FlagVector&api.Flag_i == 0 {
t.info.icon = assets.Icon_Def["diropen"].GetGlyph()
if api.FlagVector&api.Flag_c == 0 {
t.info.iconColor = assets.Icon_Def["diropen"].GetColor(1)
}
}
}
// don't fill files info if the -d flag is passed
if api.FlagVector&api.Flag_d > 0 {
t.files = append(t.files, t.info)
return t, nil
}
files, err := d.Readdir(0)
for _, v := range files {
name := v.Name()
if !showHidden && strings.HasPrefix(name, ".") {
continue
}
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 api.FlagVector&api.Flag_s > 0 {
dirBlocks(f, v)
}
if api.FlagVector&api.Flag_i == 0 {
f.icon, f.iconColor = getIcon(f.name, f.ext, f.indicator)
if api.FlagVector&api.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, name+"/")
}
}
// if -a flag is passed then only eval parent dir and append to files
if api.FlagVector&api.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 api.FlagVector&api.Flag_s > 0 {
dirBlocks(t.parent, pds)
}
if api.FlagVector&api.Flag_i == 0 {
t.parent.icon = assets.Icon_Def["diropen"].GetGlyph()
if api.FlagVector&api.Flag_c == 0 {
t.parent.iconColor = assets.Icon_Def["diropen"].GetColor(1)
}
}
t.files = append(t.files, t.parent)
}
// return *dir with no error
// or partial *dir with error (produced by Readdir)
return t, err
}
func New_ArgFiles(files []os.FileInfo) *dir {
var long bool = api.FlagVector&(api.Flag_l|api.Flag_o|api.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 api.FlagVector&api.Flag_s > 0 {
dirBlocks(f, v)
}
if api.FlagVector&api.Flag_i == 0 {
f.icon, f.iconColor = getIcon(f.name, f.ext, f.indicator)
if api.FlagVector&api.Flag_c != 0 {
f.iconColor = ""
}
}
t.files = append(t.files, f)
}
return t
}
func New_Recussion(d *os.File) {
dd, err := New(d)
d.Close()
if err != nil {
log.Printf("partial access to %q: %v\n", d.Name(), err)
sysState.ExitCode(sysState.Code_Minor)
}
// print the info of the files of the directory
var out io.Writer = os.Stdout
if runtime.GOOS == "windows" {
out = colorable.NewColorableStdout()
}
io.Copy(out, 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))
sort.Strings(dd.dirs)
for i, v := range dd.dirs {
temp[i] = filepath.Join(d.Name(), v)
}
for _, v := range temp {
fmt.Printf("\n%s:\n", OpenDirIcon+v)
f, err := os.Open(v)
if err != nil {
log.Printf("cannot access %q: %v\n", v, err)
f.Close()
sysState.ExitCode(sysState.Code_Minor)
continue
}
New_Recussion(f)
}
}
func (d *dir) Print() *bytes.Buffer {
// take care of printing, extending symbolic links in long forms
//sorting
lessFuncGenerator(d)
if api.FlagVector&api.Flag_U == 0 && api.FlagVector&api.Flag_r > 0 {
sort.Sort(sort.Reverse(d))
} else {
sort.Sort(d)
}
buf := bytes.NewBuffer([]byte(""))
switch {
case api.FlagVector&(api.Flag_l|api.Flag_o|api.Flag_g) > 0:
w := ctw.NewLong(9)
for _, v := range d.files {
if api.FlagVector&api.Flag_s > 0 {
w.AddRow(getSizeInFormate(v.blocks*512), v.mode, v.owner, v.group, getSizeInFormate(v.size), v.modTime.Format(api.GetTimeFormate()), 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(api.GetTimeFormate()), v.icon, v.name+v.ext+v.indicator, v.gitStatus)
}
w.IconColor(v.iconColor)
}
w.Flush(buf)
case api.FlagVector&api.Flag_1 > 0:
w := ctw.NewLong(4)
for _, v := range d.files {
if api.FlagVector&api.Flag_s > 0 {
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)
}
w.IconColor(v.iconColor)
}
w.Flush(buf)
default:
w := ctw.New(sysState.GetTerminalWidth())
for _, v := range d.files {
if api.FlagVector&api.Flag_s > 0 {
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)
}
w.IconColor(v.iconColor)
}
w.Flush(buf)
}
return buf
}
// sorting functions
func (d *dir) Len() int {
return len(d.files)
}
func (d *dir) Swap(i, j int) {
d.files[i], d.files[j] = d.files[j], d.files[i]
}
func (d *dir) Less(i, j int) bool {
return d.less(i, j)
}
+63
View File
@@ -0,0 +1,63 @@
// this file contain dir type definition
// +build !windows
package dir
import (
"os"
"os/user"
"strconv"
"syscall"
"github.com/Yash-Handa/logo-ls/internal/api"
)
func dirBlocks(info *file, fi os.FileInfo) {
if s, ok := fi.Sys().(*syscall.Stat_t); ok {
info.blocks = s.Blocks
}
}
func getOwnerGroupInfo(fi os.FileInfo) (o string, g string) {
if stat, ok := fi.Sys().(*syscall.Stat_t); ok {
if api.FlagVector&(api.Flag_l|api.Flag_o) > 0 {
UID := strconv.Itoa(int(stat.Uid))
if n, ok := userMap[UID]; ok {
o = n
} else {
u, err := user.LookupId(UID)
if err != nil {
o = ""
} else {
o = u.Name
userMap[UID] = u.Name
}
}
}
if api.FlagVector&api.Flag_G == 0 && api.FlagVector&(api.Flag_l|api.Flag_g) > 0 {
GID := strconv.Itoa(int(stat.Gid))
if n, ok := grpMap[GID]; ok {
g = n
} else {
grp, err := user.LookupGroupId(GID)
if err != nil {
g = ""
} else {
g = grp.Name
grpMap[GID] = grp.Name
}
}
}
}
return
}
func getFileBlocks(fi os.FileInfo) int64 {
if s, ok := fi.Sys().(*syscall.Stat_t); ok {
return s.Blocks
}
return 0
}
+16
View File
@@ -0,0 +1,16 @@
// this file contain dir type definition
// +build windows
package dir
import (
"os"
)
func dirBlocks(info *file, fi os.FileInfo) {
}
func getOwnerGroupInfo(fi os.FileInfo) (o string, g string) {
return
}
@@ -1,12 +1,12 @@
package main
package dir
import (
"fmt"
"os"
"os/user"
"strconv"
"strings"
"syscall"
"github.com/Yash-Handa/logo-ls/assets"
"github.com/Yash-Handa/logo-ls/internal/api"
)
func mainSort(a, b string) bool {
@@ -26,12 +26,12 @@ func mainSort(a, b string) bool {
// Custom less functions
func lessFuncGenerator(d *dir) {
switch {
case (flagVector & flag_alpha) > 0:
case (api.FlagVector & api.Flag_alpha) > 0:
// sort by alphabetical order of name.ext
d.less = func(i, j int) bool {
return mainSort(d.files[i].name+d.files[i].ext, d.files[j].name+d.files[j].ext)
}
case (flagVector & flag_S) > 0:
case (api.FlagVector & api.Flag_S) > 0:
// sort by file size, largest first
d.less = func(i, j int) bool {
if d.files[i].size > d.files[j].size {
@@ -42,13 +42,13 @@ func lessFuncGenerator(d *dir) {
return false
}
}
case (flagVector & flag_t) > 0:
case (api.FlagVector & api.Flag_t) > 0:
// sort by modification time, newest first
// not sorting by alphabetical order because equality is quite rare
d.less = func(i, j int) bool {
return d.files[i].modTime.After(d.files[j].modTime)
}
case (flagVector & flag_X) > 0:
case (api.FlagVector & api.Flag_X) > 0:
// sort alphabetically by entry extension
d.less = func(i, j int) bool {
if mainSort(d.files[i].ext, d.files[j].ext) {
@@ -59,7 +59,7 @@ func lessFuncGenerator(d *dir) {
return false
}
}
case (flagVector & flag_v) > 0:
case (api.FlagVector & api.Flag_v) > 0:
// natural sort of (version) numbers within text
d.less = func(i, j int) bool {
return d.files[i].name+d.files[i].ext < d.files[j].name+d.files[j].ext
@@ -76,42 +76,6 @@ func lessFuncGenerator(d *dir) {
var grpMap = make(map[string]string)
var userMap = make(map[string]string)
func getOwnerGroupInfo(fi os.FileInfo) (o string, g string) {
if stat, ok := fi.Sys().(*syscall.Stat_t); ok {
if flagVector&(flag_l|flag_o) > 0 {
UID := strconv.Itoa(int(stat.Uid))
if n, ok := userMap[UID]; ok {
o = n
} else {
u, err := user.LookupId(UID)
if err != nil {
o = ""
} else {
o = u.Name
userMap[UID] = u.Name
}
}
}
if flagVector&flag_G == 0 && flagVector&(flag_l|flag_g) > 0 {
GID := strconv.Itoa(int(stat.Gid))
if n, ok := grpMap[GID]; ok {
g = n
} else {
grp, err := user.LookupGroupId(GID)
if err != nil {
g = ""
} else {
g = grp.Name
grpMap[GID] = grp.Name
}
}
}
}
return
}
// get indicator of the file
func getIndicator(modebit os.FileMode) (i string) {
switch {
@@ -130,7 +94,7 @@ func getIndicator(modebit os.FileMode) (i string) {
}
func getSizeInFormate(b int64) string {
if flagVector&flag_h == 0 {
if api.FlagVector&api.Flag_h == 0 {
return fmt.Sprintf("%d", b)
}
@@ -146,3 +110,61 @@ 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 *assets.Icon_Info
var ok bool
switch indicator {
case "/":
i, ok = assets.Icon_Dir[strings.ToLower(name+ext)]
if ok {
break
}
if len(name) == 0 || '.' == name[0] {
i = assets.Icon_Def["hiddendir"]
break
}
i = assets.Icon_Def["dir"]
default:
i, ok = assets.Icon_FileName[strings.ToLower(name+ext)]
if ok {
break
}
// a special admiration for goLang
if ext == ".go" && strings.HasSuffix(name, "_test") {
i = assets.Icon_Set["go-test"]
break
}
t := strings.Split(name, ".")
if len(t) > 1 && t[0] != "" {
i, ok = assets.Icon_SubExt[strings.ToLower(t[len(t)-1]+ext)]
if ok {
break
}
}
i, ok = assets.Icon_Ext[strings.ToLower(strings.TrimPrefix(ext, "."))]
if ok {
break
}
if len(name) == 0 || '.' == name[0] {
i = assets.Icon_Def["hiddenfile"]
break
}
i = assets.Icon_Def["file"]
}
// change icon color if the file is executable
if indicator == "*" {
if i.GetGlyph() == "\uf723" {
i = assets.Icon_Def["exe"]
}
i.MakeExe()
}
return i.GetGlyph(), i.GetColor(1)
}
+120
View File
@@ -0,0 +1,120 @@
package dir
import (
"os/exec"
"path/filepath"
"strings"
"github.com/go-git/go-git/v5"
)
// gitStatus returns the status of modified files in the worktree. It will attempt to execute 'git status'
// and will fall back to git.Worktree.Status() if that fails.
func gitStatus(wt *git.Worktree) (git.Status, error) {
c := exec.Command("git", "status", "--porcelain", "-z")
c.Dir = wt.Filesystem.Root()
output, err := c.Output()
if err != nil {
stat, err := wt.Status()
return stat, err
}
lines := strings.Split(string(output), "\000")
stat := make(map[string]*git.FileStatus, len(lines))
for _, line := range lines {
if len(line) == 0 {
continue
}
// For copy/rename the output looks like
// R destination\000source
// Which means we can split on space and ignore anything with only one result
parts := strings.SplitN(strings.TrimLeft(line, " "), " ", 2)
if len(parts) == 2 {
stat[strings.Trim(parts[1], " ")] = &git.FileStatus{
Worktree: git.StatusCode([]byte(parts[0])[0]),
}
}
}
return stat, err
}
var (
gitRepo git.Status
gitRoot string
gitError error
gitRepoComputedAlready = false
)
func getRepoStatus(path string) (git.Status, string, error) {
if !gitRepoComputedAlready {
gitRepoComputedAlready = true
op := git.PlainOpenOptions{DetectDotGit: true}
r, err := git.PlainOpenWithOptions(path, &op)
if err != nil {
gitError = err
return nil, "", err
}
w, err := r.Worktree()
if err != nil {
gitError = err
return nil, "", err
}
ws, err := gitStatus(w)
if err != nil {
gitError = err
return nil, "", err
}
gitRepo, gitRoot, gitError = ws, w.Filesystem.Root(), nil
}
return gitRepo, gitRoot, gitError
}
// use this function when multiple dirs are given as input, to recalculate the git tree for each
func GitRepoCompute() {
gitRepoComputedAlready = false
}
func getFilesGitStatus(p string) map[string]string {
gitRepo, gitRoot, err := getRepoStatus(p)
if err != nil || len(gitRepo) == 0 {
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 ""
}
+37
View File
@@ -0,0 +1,37 @@
// This file has sysState data that is set and used by other file
package sysState
// terminal width for formatting [default to 80]
var terminalWidth int = 80
func TerminalWidth(w int) {
terminalWidth = w
}
func GetTerminalWidth() int {
return terminalWidth
}
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 ExitCode(c int) {
switch {
case c == Code_Serious:
osExitCode = Code_Serious
case c == Code_Minor && osExitCode != Code_Serious:
osExitCode = Code_Minor
}
}
func GetExitCode() int {
return osExitCode
}
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>
+43 -236
View File
@@ -5,237 +5,33 @@ import (
"io"
"log"
"os"
"runtime"
"sort"
"time"
"github.com/pborman/getopt/v2"
"golang.org/x/crypto/ssh/terminal"
"github.com/Yash-Handa/logo-ls/assets"
"github.com/Yash-Handa/logo-ls/internal/api"
"github.com/Yash-Handa/logo-ls/internal/ctw"
"github.com/Yash-Handa/logo-ls/internal/dir"
"github.com/Yash-Handa/logo-ls/internal/sysState"
"github.com/mattn/go-colorable"
)
// flags with corresponding bit values
// frequently used flags should be higher in the list
// help (-?) and version (-V) not included
const (
flag_l uint = 1 << iota
flag_a
flag_alpha // sort in alphabetic order (default)
flag_A
flag_h
flag_R
flag_r
flag_S
flag_t
flag_X
flag_s
flag_v
flag_U
flag_1
flag_d
flag_o
flag_g
flag_G
)
// 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
}
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 ..")
// load flags into api.FlagVector and other sysState update stuff
api.Bootstrap()
// display flags
f_1 := getopt.Bool('1', "list one file per line.")
f_d := getopt.BoolLong("directory", 'd', "list directories themselves, not their contents")
f_l := getopt.Bool('l', "use a long listing format")
f_o := getopt.Bool('o', "like -l, but do not list group information")
f_g := getopt.Bool('g', "\nlike -l, but do not list owner")
f_G := getopt.BoolLong("no-group", 'G', "in a long listing, don't print group names")
f_h := getopt.BoolLong("human-readable", 'h', "with -l and -s, print sizes like 1K 234M 2G etc.")
f_s := getopt.BoolLong("size", 's', "print the allocated size of each file, in blocks")
// sorting flags
f_S := getopt.Bool('S', "sort by file size, largest first")
f_U := getopt.Bool('U', "do not sort; list entries in directory order")
f_X := getopt.Bool('X', "sort alphabetically by entry extension")
f_v := getopt.Bool('v', "natural sort of (version) numbers within text")
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_V := getopt.BoolLong("version", 'V', "output version information and exit")
// using getopt.Getopt instead of parse to provide custom err
err := getopt.Getopt(nil)
if err != nil {
// code to handle error
log.Printf("%v\nTry 'logo-ls -?' for more information.", err)
os.Exit(set_osExitCode(code_Serious))
// config ctw and OpenDirIcon
if api.FlagVector&api.Flag_c > 0 {
ctw.DisplayColor(false)
dir.OpenDirIcon = assets.Icon_Def["diropen"].GetGlyph() + " "
}
// if f_help is provided print help and exit(0)
if *f_help {
getopt.PrintUsage(os.Stdout)
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")
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", "v1.1.0")
os.Exit(osExitCode)
}
// set one of -A and -a priority -A > -a
switch {
case *f_A:
flagVector |= flag_A
case *f_a:
flagVector |= flag_a
}
// set one of -S, -U, -X, -v, -t and alpha priority -S > -t > -X > -v > -U > alpha
switch {
case *f_S:
flagVector |= flag_S
case *f_t:
flagVector |= flag_t
case *f_X:
flagVector |= flag_X
case *f_v:
flagVector |= flag_v
case *f_U:
flagVector |= flag_U
default:
flagVector |= flag_alpha
}
// set reverse (-r) flag
if *f_r {
flagVector |= flag_r
}
// set recursion (-R) flag
if *f_R {
flagVector |= flag_R
}
// set -1 flag
if *f_1 {
flagVector |= flag_1
}
// set -d flag
if *f_d {
flagVector |= flag_d
}
// set -G flag
if *f_G {
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
}
// set -s flag
if *f_s {
flagVector |= flag_s
}
// set one of -o, -g and -l priority -o > -g > -l
switch {
case *f_o:
flagVector |= flag_o
case *f_g:
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
}
if api.FlagVector&api.Flag_i > 0 {
dir.OpenDirIcon = ""
ctw.DisplayBrailEmpty(false)
}
// extract files/dir from arguments
dirs := getopt.Args()
dirs := api.FileList
if len(dirs) == 0 {
// use pwd
dirs = append(dirs, ".")
@@ -254,14 +50,14 @@ func main() {
if err != nil {
log.Printf("cannot access %q: %v\n", v, err)
d.Close()
_ = set_osExitCode(code_Serious)
sysState.ExitCode(sysState.Code_Serious)
continue
}
ds, err := d.Stat()
if err != nil {
log.Printf("cannot access %q: %v\n", v, err)
d.Close()
_ = set_osExitCode(code_Serious)
sysState.ExitCode(sysState.Code_Serious)
continue
}
if ds.IsDir() {
@@ -271,47 +67,58 @@ func main() {
}
}
var out io.Writer = os.Stdout
if runtime.GOOS == "windows" {
out = colorable.NewColorableStdout()
}
// process and display all files
io.Copy(os.Stdout, newDir_ArgFiles(args.files).print())
if len(args.files) > 0 && len(args.dirs) > 0 {
fmt.Println()
if len(args.files) > 0 {
io.Copy(out, dir.New_ArgFiles(args.files).Print())
if len(args.dirs) > 0 {
fmt.Println()
}
}
// process and display all the dirs in arg
if flagVector&flag_R > 0 {
if api.FlagVector&api.Flag_R > 0 {
// use recursive func
for i, v := range args.dirs {
if i > 0 {
fmt.Println()
}
fmt.Printf("%s:\n", v.Name())
newDirs_Recussion(v)
fmt.Printf("%s:\n", dir.OpenDirIcon+v.Name())
if api.FlagVector&api.Flag_D > 0 {
dir.GitRepoCompute()
}
dir.New_Recussion(v)
}
} else {
pName := len(dirs) > 1
for i, v := range args.dirs {
if pName {
fmt.Printf("%s:\n", v.Name())
fmt.Printf("%s:\n", dir.OpenDirIcon+v.Name())
}
d, err := newDir(v)
if api.FlagVector&api.Flag_D > 0 {
dir.GitRepoCompute()
}
d, err := dir.New(v)
v.Close()
if err != nil {
log.Printf("partial access to %q: %v\n", v.Name(), err)
_ = set_osExitCode(code_Serious)
sysState.ExitCode(sysState.Code_Serious)
}
// print the info of the files of the directory
io.Copy(os.Stdout, d.print())
io.Copy(out, d.Print())
if i < len(args.dirs)-1 {
fmt.Println()
}
}
}
os.Exit(osExitCode)
os.Exit(sysState.GetExitCode())
}
func init() {
getopt.SetParameters("[files ...]")
log.SetPrefix("logo-ls: ")
log.SetFlags(0)
}
+50
View File
@@ -0,0 +1,50 @@
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.
-?, --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).
+11
View File
@@ -0,0 +1,11 @@
ﳑ1test.go
2test.js
3test.py
abc.css
abc.sass
.abc.txt
Dockerfile
Downloads/
.privateDir/
נּtest.routes.tsx
testDir/
+17
View File
@@ -0,0 +1,17 @@
ﱮ testdata/dirEnv:
ﳑ1test.go
2test.js
3test.py
abc.css
abc.sass
Dockerfile
Downloads/
נּtest.routes.tsx
testDir/
ﱮ testdata/dirEnv/Downloads:
ﱮ testdata/dirEnv/testDir:
ﳑ1test.go
2test.js
abc.txt
+32
View File
@@ -0,0 +1,32 @@
ﱮ testdata/dirEnv:
ﱮ.
ﱮ..
ﳑ1test.go
2test.js
3test.py
abc.css
abc.sass
.abc.txt
Dockerfile
Downloads/
.privateDir/
נּtest.routes.tsx
testDir/
ﱮ testdata/dirEnv/.privateDir:
ﱮ.
ﱮ..
ﳑ1test.go
2test.js
abc.txt
ﱮ testdata/dirEnv/Downloads:
ﱮ.
ﱮ..
ﱮ testdata/dirEnv/testDir:
ﱮ.
ﱮ..
ﳑ1test.go
2test.js
abc.txt
+7
View File
@@ -0,0 +1,7 @@
logo-ls v1.3.7
Copyright (c) 2020 Yash Handa
License MIT <https://opensource.org/licenses/MIT>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Yash Handa
+13
View File
@@ -0,0 +1,13 @@
ﱮ.
ﱮ..
ﳑ1test.go
2test.js
3test.py
abc.css
abc.sass
.abc.txt
Dockerfile
Downloads/
.privateDir/
נּtest.routes.tsx
testDir/
+9
View File
@@ -0,0 +1,9 @@
1test.go
2test.js
3test.py
abc.css
abc.sass
Dockerfile
Downloads/
test.routes.tsx
testDir/
+9
View File
@@ -0,0 +1,9 @@
testDir/
נּtest.routes.tsx
Downloads/
Dockerfile
abc.sass
abc.css
3test.py
2test.js
ﳑ1test.go
+9
View File
@@ -0,0 +1,9 @@
4.0Kﳑ1test.go
4.0K2test.js
4.0K3test.py
4.0Kabc.css
4.0Kabc.sass
4.0KDockerfile
4.0KDownloads/
4.0Kנּtest.routes.tsx
4.0KtestDir/
+32
View File
@@ -0,0 +1,32 @@
ﱮ testdata/dirEnv:
4.0Kﱮ.
4.0Kﱮ..
4.0Kﳑ1test.go
4.0K2test.js
4.0K3test.py
4.0Kabc.css
4.0Kabc.sass
4.0K.abc.txt
4.0KDockerfile
4.0KDownloads/
4.0K.privateDir/
4.0Kנּtest.routes.tsx
4.0KtestDir/
ﱮ testdata/dirEnv/.privateDir:
4.0Kﱮ.
4.0Kﱮ..
4.0Kﳑ1test.go
4.0K2test.js
4.0Kabc.txt
ﱮ testdata/dirEnv/Downloads:
4.0Kﱮ.
4.0Kﱮ..
ﱮ testdata/dirEnv/testDir:
4.0Kﱮ.
4.0Kﱮ..
4.0Kﳑ1test.go
4.0K2test.js
4.0Kabc.txt
+9
View File
@@ -0,0 +1,9 @@
ﳑ1test.go
2test.js
3test.py
abc.css
abc.sass
Dockerfile
Downloads/
נּtest.routes.tsx
testDir/