Commit 7cd3074

bryfry <bryon@fryer.io>
2025-09-17 12:21:52
no-wait tasking
1 parent 07d2f70
cmd/task.go
@@ -12,8 +12,9 @@ import (
 )
 
 var (
-	taskWaitTime int
+	taskWaitTime  int
 	taskRawOutput bool
+	taskNoWait    bool
 )
 
 var taskCmd = &cobra.Command{
@@ -29,6 +30,7 @@ func init() {
 	rootCmd.AddCommand(taskCmd)
 	taskCmd.Flags().IntVarP(&taskWaitTime, "wait", "w", 30, "Maximum time to wait for response (seconds)")
 	taskCmd.Flags().BoolVar(&taskRawOutput, "raw", false, "Output only raw response bytes")
+	taskCmd.Flags().BoolVar(&taskNoWait, "no-wait", false, "Create task but don't wait for response")
 }
 
 func runTask(cmd *cobra.Command, args []string) error {
@@ -56,6 +58,20 @@ func runTask(cmd *cobra.Command, args []string) error {
 		return err
 	}
 
+	if taskNoWait {
+		// Create task but don't wait for response
+		task, err := client.CreateTask(ctx, targetCallback.ID, command, params)
+		if err != nil {
+			return fmt.Errorf("failed to create task: %w", err)
+		}
+
+		if !taskRawOutput {
+			fmt.Printf("Task %d created on callback %d (%s@%s) - not waiting for response\n",
+				task.DisplayID, callbackID, targetCallback.User, targetCallback.Host)
+		}
+		return nil
+	}
+
 	// For raw output, don't show progress messages
 	if !taskRawOutput {
 		fmt.Printf("Executing '%s %s' on callback %d (%s@%s)\n",
cmd/task_list.go
@@ -32,7 +32,7 @@ func init() {
 	rootCmd.AddCommand(taskListCmd)
 	taskListCmd.Flags().BoolVar(&listShowResponses, "responses", false, "Show task responses/output")
 	taskListCmd.Flags().IntVar(&listTaskLimit, "limit", 10, "Maximum number of tasks to display")
-	taskListCmd.Flags().BoolVar(&listShowAll, "all", false, "Show all tasks (same as --limit 0)")
+	taskListCmd.Flags().BoolVarP(&listShowAll, "all", "a", false, "Show all tasks (same as --limit 0)")
 }
 
 func runTaskList(cmd *cobra.Command, args []string) error {
README.md
@@ -83,16 +83,19 @@ mysh callbacks
 ### Execute Commands
 ```bash
 # Get help for all commands from callback 1
-mysh exec 1 help
+mysh task 1 help
 
 # Get detailed help for a specific command
-mysh exec 1 help p
+mysh task 1 help p
 
 # List processes
-mysh exec 1 ps
+mysh task 1 ps
 
 # Set checkin frequency to 5 seconds
-mysh exec 1 sleep 5
+mysh task 1 sleep 5
+
+# Create task without waiting for response
+mysh task 1 ps --no-wait
 ```
 
 ### Interactive Session
TODO.md
@@ -1,9 +1,11 @@
 - ✅ grep should also look at the command execution strings too, not just output
 - ✅ Renamed project from go-mythic to mysh (pronounced mɪʃh)
-- ✅ task-list --all (same as --limit 0)
-- task-list without callback lists all tasks and shows callback column
+- ✅ task-list --all (same as --limit 0), and -a
+- ✅ task-list without callback lists all tasks and shows callback column
 - task with --no-wait, doesn't wait for output
 - task [callback] arg make it accept lists, comma seperated, or ranges e.g. 1,2,3-5,10
 - invert cobra-cli nto functions (no global vars)
 - update output table formats to respect terminal width
+- create a .cache/mysh/ for task result cached values
+- MYTHIC_API_INSECURE= boolean --insecure flag - and invert default = false
 - forge payloads - equivalency with execute_assembly and inline_assembly