Inspect checks whether an inspection was requested, and sends Script.Name() to editor if so. When editor exits, Inspect prompts the user to continue processing, and returns true to continue or false to stop.
(inspect bool, editor string)
| 187 | // to editor if so. When editor exits, Inspect prompts the user to continue |
| 188 | // processing, and returns true to continue or false to stop. |
| 189 | func (s Script) Inspect(inspect bool, editor string) bool { |
| 190 | if !inspect || s.IsPiped() { |
| 191 | return true |
| 192 | } |
| 193 | |
| 194 | log.Println("Opening", s.Name(), "in", editor) |
| 195 | |
| 196 | cmd := exec.Command(editor, s.Name()) |
| 197 | cmd.Stdout = os.Stdout |
| 198 | cmd.Stderr = os.Stderr |
| 199 | cmd.Stdin = os.Stdin |
| 200 | cmd.Run() |
| 201 | |
| 202 | runScript := "y" |
| 203 | fmt.Print("Continue processing ", s.Name(), "? (Y/n) ") |
| 204 | fmt.Scanf("%s", &runScript) |
| 205 | |
| 206 | return strings.ToLower(runScript) == "y" |
| 207 | } |
| 208 | |
| 209 | // IsClearsigned returns true if the script and signature are attached, |
| 210 | // and false otherwise. |