mpl avatar mpl committed 0dcafdc

cleanup, doc, gofmt, removed confusing todos

Comments (0)

Files changed (2)

 Xplor, hold it, and at the same time press button 1.  Tadaaa!  behold
 the chording magic!
 
+DotDot redraws xplor with the root set as the parent directory.
+
+Hidden toggles displaying the hidden files/directories. It does not redraw the tree.
+
 Enjoy!
 package main
 
 import (
-	"os"
-	//	"bytes"
 	"flag"
 	"fmt"
+	"os"
 	"os/exec"
 	"path"
 	"sort"
 	"strings"
-	//	"bytes"
 
 	"bitbucket.org/fhs/goplumb/plumb"
 	"code.google.com/p/goplan9/plan9"
 )
 
 var (
-	root     string
-	w        *acme.Win
-	PLAN9    = os.Getenv("PLAN9")
-	unfolded map[int]string
+	root       string
+	w          *acme.Win
+	PLAN9      = os.Getenv("PLAN9")
 	showHidden bool
 )
 
 	os.Exit(2)
 }
 
-//BUG: /home/mpl/work/iram/casa/active/linux_64b/bin/ ne s'ouvre pas
-//TODO: make a closeAll command ?
-//TODO: keep a list of unfolded  dirs because it will be faster to go through that list and find the right parent for a file when constructing the fullpath, than going recursively up. After some experimenting, it's not that easy to do, so I may as well make a full rework that uses a tree in memory to map the filesystem tree, rather than go all textual.
-
 func main() {
 	flag.Usage = usage
 	flag.Parse()
 		fmt.Fprintf(os.Stderr, err.Error())
 		return
 	}
-	//	unfolded = make(map[string] int, 1)
 
-	// TODO(mpl): switch insteaf of ifs
 	for word := range events() {
 		if len(word) >= 6 && word[0:6] == "DotDot" {
 			doDotDot()
 	return ""
 }
 
-//TODO: maybe break this one in a fold and unfold functions
+// TODO(mpl): maybe break this one in a fold and unfold functions
 func onLook(charaddr string) {
 	// reconstruct full path and check if file or dir
 	addr := "#" + charaddr + "+1-"
 	}
 }
 
-//TODO: deal with errors
 func getFullPath(charaddr string) (fullpath string, err error) {
 	// reconstruct full path and print it to Stdout
 	addr := "#" + charaddr + "+1-"
 	}
 }
 
-/*
-// For this function to work as intended, it needs to be coupled with a
-// plumbing rule, such as:
-// # start rc from xplor in an acme win at the specified path 
-// type is text
-// src is xplor
-// dst is win
-// plumb start win rc -c '@{cd '$data'; exec rc -l}'
-func doPlumb(loc string, dst string) {
-	var fullpath string
-	if loc == "" {
-		fullpath = root
-	} else {
-		var err os.Error
-		charaddr := strings.SplitAfter(loc, ",#", 2) 
-		fullpath, err = getFullPath(charaddr[1])
-		if err != nil {
-			fmt.Fprintf(os.Stderr, err.String())
-			return
-		}
-		fi, err := os.Lstat(fullpath)
-		if err != nil {
-			fmt.Fprintf(os.Stderr, err.String())
-			return
-		}
-		if !fi.IsDirectory() {
-			fullpath, _ = path.Split(fullpath)
-		}
-	}
-	// send the fullpath as a win command to the plumber
-	port, err := plumb.Open("send", plan9.OWRITE)
-	if err != nil {
-		fmt.Fprintf(os.Stderr, err.String())
-		return
-	}
-//	defer port.Close()
-	err = port.Send(&plumb.Msg{
-		Src:  "xplor",
-		Dst:  dst,
-		WDir: "/",
-		Kind: "text",
-		Attr: map[string]string{},
-		Data: []byte(fullpath),
-	})
-	if err != nil {
-		fmt.Fprintf(os.Stderr, err.String())
-	}
-	port.Close()
-	return
-}
-*/
-
 func doExec(loc string, cmd string) {
 	var fullpath string
 	if loc == "" {
 }
 
 func toggleHidden() {
-	// TODO(mpl): do a full redraw?
 	showHidden = !showHidden
 }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.