diff --git a/README.md b/README.md index 44cc384..348d568 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,4 @@ uv run pre-commit install - `flow rebase` — rebase the current branch onto the latest default branch - `flow push` — force-push the current branch (refused on the default branch) - `flow clean` — delete local branches whose PRs have been merged +- `flow dirty` — show the stash list and all local branches diff --git a/main.go b/main.go index 2ddec36..38058ff 100644 --- a/main.go +++ b/main.go @@ -30,7 +30,7 @@ func run(name string, args ...string) { func main() { if len(os.Args) < 2 { fmt.Fprintf(os.Stderr, "usage: flow [args]\n") - fmt.Fprintf(os.Stderr, "commands: branch, create, view, merge, clean, rebase, push\n") + fmt.Fprintf(os.Stderr, "commands: branch, create, view, merge, clean, rebase, push, dirty\n") os.Exit(2) } @@ -49,9 +49,11 @@ func main() { cmdRebase(os.Args[2:]) case "push": cmdPush(os.Args[2:]) + case "dirty": + cmdDirty(os.Args[2:]) default: fmt.Fprintf(os.Stderr, "flow: unknown command %q\n", os.Args[1]) - fmt.Fprintf(os.Stderr, "commands: branch, create, view, merge, clean, rebase, push\n") + fmt.Fprintf(os.Stderr, "commands: branch, create, view, merge, clean, rebase, push, dirty\n") os.Exit(2) } } @@ -228,6 +230,16 @@ func cmdPush(args []string) { run("git", "push", "--force") } +func cmdDirty(args []string) { + if len(args) > 0 { + fmt.Fprintf(os.Stderr, "usage: flow dirty\n") + os.Exit(2) + } + + run("git", "stash", "list") + run("git", "branch") +} + func cmdRebase(args []string) { if len(args) > 0 { fmt.Fprintf(os.Stderr, "usage: flow rebase\n")