From 865feb3584c5b32e8b9a1647a964dd51436ff616 Mon Sep 17 00:00:00 2001 From: Sam Abradi Date: Wed, 3 Sep 2014 14:21:21 -0400 Subject: [PATCH] added tiny basic ls implimentation, doesnt take any args other than the directory to list, doesnt even jsonify the output, literally bare bonest ls to make sure I can do the backend part of ls --- ls.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 ls.go diff --git a/ls.go b/ls.go new file mode 100644 index 0000000..4022b26 --- /dev/null +++ b/ls.go @@ -0,0 +1,22 @@ +package main + +import ( + "io/ioutil" + "fmt" +// "encoding/json" +// "os" + "flag" +) + + + +func main() { + //dec := json.NewDecoder(os.Stdin) + //enc := json.NewEncoder(os.Stdout) + flag.Parse() + root := flag.Arg(0) + dir,_ := ioutil.ReadDir(root) + for _,entry := range dir{ + fmt.Printf("%s\n", entry.Name()) + } +}