mirror of
https://github.com/Yash-Handa/logo-ls.git
synced 2026-08-27 02:24:28 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6f6bee415 | ||
|
|
8be883a8de | ||
|
|
3548235135 | ||
|
|
e7baa8cbbd |
@@ -0,0 +1 @@
|
||||
// An empty go.mod file to refrain this dir to be distributed with the cli tool
|
||||
@@ -48,6 +48,8 @@ Command and Arguments supported are listed in [HELP.md](/HELP.md)
|
||||
- [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)
|
||||
@@ -318,9 +320,70 @@ If you want the man page of `logo-ls` place `logo-ls.1.gz` in `/usr/share/man/ma
|
||||
$ 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 bellow steps to check its authenticity.
|
||||
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
|
||||
|
||||
|
||||
@@ -94,6 +94,13 @@ func (w *CTW) Flush(buf *bytes.Buffer) {
|
||||
|
||||
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
|
||||
|
||||
@@ -58,6 +58,9 @@ func newDir(d *os.File) (*dir, error) {
|
||||
var gitRepoStatus map[string]string // could be nil
|
||||
if flagVector&flag_D > 0 {
|
||||
gitRepoStatus = getFilesGitStatus(d.Name()) // returns map or nil
|
||||
if len(gitRepoStatus) == 0 {
|
||||
gitRepoStatus = nil
|
||||
}
|
||||
}
|
||||
|
||||
if curDir {
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ func getRepoStatus(path string) (git.Status, string, error) {
|
||||
|
||||
func getFilesGitStatus(p string) map[string]string {
|
||||
gitRepo, gitRoot, err := getRepoStatus(p)
|
||||
if err != nil {
|
||||
if err != nil || len(gitRepo) == 0 {
|
||||
return nil
|
||||
}
|
||||
pAbs, err := filepath.Abs(p)
|
||||
|
||||
Binary file not shown.
@@ -142,7 +142,7 @@ func main() {
|
||||
|
||||
// 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.4")
|
||||
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.5")
|
||||
fmt.Println("\nWritten by Yash Handa")
|
||||
os.Exit(osExitCode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user