()
| 404 | } |
| 405 | |
| 406 | func (a *App) updateCmd() error { |
| 407 | files, err := a.repo.ListModified("file-only") |
| 408 | if err != nil { |
| 409 | return err |
| 410 | } |
| 411 | |
| 412 | if len(files) == 0 { |
| 413 | return nil |
| 414 | } |
| 415 | |
| 416 | var fileItems []interface{} |
| 417 | for _, file := range files { |
| 418 | fileItems = append(fileItems, file) |
| 419 | } |
| 420 | |
| 421 | fmt.Printf(a.colored(a.colors.HeaderColor, "%12s %12s %s\n"), "staged", "unstaged", "path") |
| 422 | chosen, err := a.listAndChoose("Update", fileItems, false, false) |
| 423 | if err != nil { |
| 424 | return err |
| 425 | } |
| 426 | |
| 427 | if len(chosen) > 0 { |
| 428 | var paths []string |
| 429 | for _, item := range chosen { |
| 430 | file := item.(git.FileStatus) |
| 431 | paths = append(paths, file.Path) |
| 432 | } |
| 433 | |
| 434 | args := append([]string{"update-index", "--add", "--remove", "--"}, paths...) |
| 435 | _, err := a.repo.RunCommand(args...) |
| 436 | if err != nil { |
| 437 | return err |
| 438 | } |
| 439 | |
| 440 | fmt.Printf("updated %d path(s)\n", len(paths)) |
| 441 | } |
| 442 | |
| 443 | fmt.Println() |
| 444 | return nil |
| 445 | } |
| 446 | |
| 447 | func (a *App) revertCmd() error { |
| 448 | files, err := a.repo.ListModified("") |
nothing calls this directly
no test coverage detected