feat(v0.4): add --force flag on resume, last, and open

This commit is contained in:
2026-04-21 17:07:04 -04:00
parent 25b2b46171
commit 67138584d4
3 changed files with 14 additions and 4 deletions
+3 -1
View File
@@ -20,11 +20,13 @@ var lastCmd = &cobra.Command{
var (
lastShell bool
lastAgent string
lastForce bool
)
func init() {
lastCmd.Flags().BoolVar(&lastShell, "shell", false, "Open shell instead of agent")
lastCmd.Flags().StringVarP(&lastAgent, "agent", "a", "", "Override agent command")
lastCmd.Flags().BoolVar(&lastForce, "force", false, "Skip active-session and stale-workspace warnings")
rootCmd.AddCommand(lastCmd)
}
@@ -40,5 +42,5 @@ func runLast(cmd *cobra.Command, args []string) error {
os.Exit(1)
}
return doResume(best.Meta.Slug, false, lastShell, lastAgent)
return doResume(best.Meta.Slug, false, lastShell, lastForce, lastAgent)
}
+6 -1
View File
@@ -19,10 +19,14 @@ var openCmd = &cobra.Command{
RunE: runOpen,
}
var openAll bool
var (
openAll bool
openForce bool
)
func init() {
openCmd.Flags().BoolVarP(&openAll, "all", "a", false, "Include archived workspaces in query resolution")
openCmd.Flags().BoolVar(&openForce, "force", false, "Skip active-session and stale-workspace warnings")
rootCmd.AddCommand(openCmd)
}
@@ -47,5 +51,6 @@ func runOpen(cmd *cobra.Command, args []string) error {
Mode: ws.Meta.Mode,
Slug: ws.Meta.Slug,
Shell: true, // open always launches shell
Force: openForce,
})
}
+5 -2
View File
@@ -24,21 +24,23 @@ var (
resumeContainer bool
resumeShell bool
resumeAgent string
resumeForce bool
)
func init() {
resumeCmd.Flags().BoolVar(&resumeContainer, "container", false, "Resume in container mode (deferred)")
resumeCmd.Flags().BoolVar(&resumeShell, "shell", false, "Open shell instead of agent")
resumeCmd.Flags().StringVarP(&resumeAgent, "agent", "a", "", "Override agent command")
resumeCmd.Flags().BoolVar(&resumeForce, "force", false, "Skip active-session and stale-workspace warnings")
rootCmd.AddCommand(resumeCmd)
}
func runResume(cmd *cobra.Command, args []string) error {
return doResume(args[0], resumeContainer, resumeShell, resumeAgent)
return doResume(args[0], resumeContainer, resumeShell, resumeForce, resumeAgent)
}
// doResume is the shared resume logic used by both resume and last commands.
func doResume(query string, container, useShell bool, agentOverride string) error {
func doResume(query string, container, useShell, force bool, agentOverride string) error {
if container {
fmt.Println(shell.ContainerNotice())
return nil
@@ -69,5 +71,6 @@ func doResume(query string, container, useShell bool, agentOverride string) erro
Mode: ws.Meta.Mode,
Slug: ws.Meta.Slug,
Shell: useShell,
Force: force,
})
}