Remove the -proc option and make it the default

This commit is contained in:
Michael Gehring
2014-11-14 08:41:12 +01:00
parent 2029001583
commit 7f17a2fdeb
2 changed files with 4 additions and 6 deletions

View File

@ -33,7 +33,7 @@ The debugger can be launched in three ways:
* Provide the name of the program you want to debug, and the debugger will launch it for you. * Provide the name of the program you want to debug, and the debugger will launch it for you.
``` ```
$ dlv -proc path/to/program $ dlv path/to/program
``` ```
* Provide the pid of a currently running process, and the debugger will attach and begin the session. * Provide the pid of a currently running process, and the debugger will attach and begin the session.

View File

@ -33,7 +33,6 @@ func main() {
var ( var (
pid int pid int
proc string
run bool run bool
printv bool printv bool
err error err error
@ -43,12 +42,11 @@ func main() {
) )
flag.IntVar(&pid, "pid", 0, "Pid of running process to attach to.") flag.IntVar(&pid, "pid", 0, "Pid of running process to attach to.")
flag.StringVar(&proc, "proc", "", "Path to process to run and debug.")
flag.BoolVar(&run, "run", false, "Compile program and begin debug session.") flag.BoolVar(&run, "run", false, "Compile program and begin debug session.")
flag.BoolVar(&printv, "v", false, "Print version number and exit.") flag.BoolVar(&printv, "v", false, "Print version number and exit.")
flag.Parse() flag.Parse()
if flag.NFlag() == 0 { if flag.NFlag() == 0 && len(flag.Args()) == 0 {
flag.Usage() flag.Usage()
os.Exit(0) os.Exit(0)
} }
@ -77,8 +75,8 @@ func main() {
if err != nil { if err != nil {
die(1, "Could not attach to process:", err) die(1, "Could not attach to process:", err)
} }
case proc != "": default:
dbgproc, err = proctl.Launch(append([]string{proc}, flag.Args()...)) dbgproc, err = proctl.Launch(flag.Args())
if err != nil { if err != nil {
die(1, "Could not launch program:", err) die(1, "Could not launch program:", err)
} }