timob / ls Goto Github PK
View Code? Open in Web Editor NEWList directory Unix utility written in Go.
License: BSD 2-Clause "Simplified" License
List directory Unix utility written in Go.
License: BSD 2-Clause "Simplified" License
On an Amazon Linux EBS ec2 instance:
$ ~/bin/ls -l
total 16
drwxrwxr-x 2 ec2-user ec2-user 4096 Mar 11 20:06 bin
drwxrwxr-x 2 ec2-user ec2-user 4096 Mar 11 20:02 downloads
drwxr-xr-x 6 ec2-user ec2-user 4096 Apr 10 2015 jre1.7.0_79
drwxrwxr-x 3 ec2-user ec2-user 4096 Mar 11 19:38 src
On OSX:
cd /Volumes/UNTITLED
ls
2017/04/15 17:16:22 lstat .: invalid argument
Get lstat .: invalid argument
when CWD is a USB Flash drive with FAT filesystem.
When explicitly passing $PWD as arguments. It works ok.
On OSX
With alias ls='ls --color=always -h -C -P --width=$COLUMS"
Build from 2017-4
just an ls
hung once.
Thank you for this implementation of ls in Go.
This is a very small nit. There are two typos of "unknown."
diff --git a/lib/generic.go b/lib/generic.go
index 6ff31ee..9674928 100644
--- a/lib/generic.go
+++ b/lib/generic.go
@@ -18,7 +18,7 @@ func GetTermSize() (int, int, error) {
}
func GetLongInfo(info os.FileInfo) *LongInfo {
- return &LongInfo{"unkown", "unkown", 1, 1}
+ return &LongInfo{"unknown", "unknown", 1, 1}
}
func IsTerminal(fd int) bool {
and
diff --git a/ls.go b/ls.go
index a05e6a7..e31e12c 100644
--- a/ls.go
+++ b/ls.go
@@ -675,7 +675,7 @@ Sort entries alphabetically unless a sort option is given.
log.Fatalf("invalid line width: %s", numStr)
}
} else {
- log.Fatalf("unkown option %s", option)
+ log.Fatalf("unknown option %s", option)
}
}
}
This would mean an ulimited number of columns, regardless of terminal width.
The same effect is possible now by specifying a large --width
argument. But is not easy to get ouput with a specific number of lines.
The whole point of this is to pipe into less and then use the right arrow key to display all the columns.
(Not a go-adept, yet.)
After the git pull and "go get", with a fresh go install on Windows 10, "go build" fails with a complaint about no definition for Strcoll(). Otherwise, the Windows build is fine, as demonstrated by eliminating use of Strcoll() in 2 places.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.