Browse Source

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

Sam Abradi 5 years ago
parent
commit
865feb3584
1 changed files with 22 additions and 0 deletions
  1. 22
    0
      ls.go

+ 22
- 0
ls.go View File

@@ -0,0 +1,22 @@
1
+package main
2
+
3
+import (
4
+  "io/ioutil"
5
+  "fmt"
6
+//  "encoding/json"
7
+//  "os"
8
+  "flag"
9
+)
10
+
11
+
12
+
13
+func main() {
14
+  //dec := json.NewDecoder(os.Stdin)
15
+  //enc := json.NewEncoder(os.Stdout)
16
+  flag.Parse()
17
+  root := flag.Arg(0)
18
+  dir,_ := ioutil.ReadDir(root)
19
+  for _,entry := range dir{
20
+      fmt.Printf("%s\n", entry.Name())
21
+  }
22
+}

Loading…
Cancel
Save