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
This commit is contained in:
parent
56437f6bfa
commit
865feb3584
22
ls.go
Normal file
22
ls.go
Normal file
@ -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())
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user