diff --git a/README.md b/README.md index 5a88811d..f2e1399f 100644 --- a/README.md +++ b/README.md @@ -140,9 +140,9 @@ multica workspace list # List all workspaces you belong to The daemon monitors one or more workspaces for tasks. Manage which workspaces are watched: ```bash -multica watch # Add a workspace to the watch list -multica unwatch # Remove a workspace from the watch list -multica watches # Show the current watch list +multica workspace watch # Add a workspace to the watch list +multica workspace unwatch # Remove a workspace from the watch list +multica workspace list # Show all workspaces (watched ones marked with *) ``` The watch list is stored in `~/.multica/config.json`. Changes are picked up by a running daemon within 5 seconds (hot-reload). @@ -156,7 +156,7 @@ The daemon polls watched workspaces for tasks and executes them using locally in multica auth login # 2. Add workspaces to watch -multica watch +multica workspace watch # 3. Start the daemon multica daemon diff --git a/server/cmd/multica/cmd_workspace.go b/server/cmd/multica/cmd_workspace.go index 85600bcf..9e74d61b 100644 --- a/server/cmd/multica/cmd_workspace.go +++ b/server/cmd/multica/cmd_workspace.go @@ -23,28 +23,24 @@ var workspaceListCmd = &cobra.Command{ RunE: runWorkspaceList, } -var watchCmd = &cobra.Command{ +var workspaceWatchCmd = &cobra.Command{ Use: "watch ", Short: "Add a workspace to the daemon watch list", Args: cobra.ExactArgs(1), RunE: runWatch, } -var unwatchCmd = &cobra.Command{ +var workspaceUnwatchCmd = &cobra.Command{ Use: "unwatch ", Short: "Remove a workspace from the daemon watch list", Args: cobra.ExactArgs(1), RunE: runUnwatch, } -var watchesCmd = &cobra.Command{ - Use: "watches", - Short: "List workspaces the daemon is watching", - RunE: runWatches, -} - func init() { workspaceCmd.AddCommand(workspaceListCmd) + workspaceCmd.AddCommand(workspaceWatchCmd) + workspaceCmd.AddCommand(workspaceUnwatchCmd) } func runWorkspaceList(cmd *cobra.Command, _ []string) error { @@ -153,26 +149,3 @@ func runUnwatch(_ *cobra.Command, args []string) error { fmt.Fprintf(os.Stderr, "Stopped watching workspace %s\n", workspaceID) return nil } - -func runWatches(_ *cobra.Command, _ []string) error { - cfg, err := cli.LoadCLIConfig() - if err != nil { - return err - } - - if len(cfg.WatchedWorkspaces) == 0 { - fmt.Fprintln(os.Stderr, "No watched workspaces. Run 'multica watch ' to add one.") - return nil - } - - w := tabwriter.NewWriter(os.Stdout, 0, 4, 2, ' ', 0) - fmt.Fprintln(w, "ID\tNAME") - for _, ws := range cfg.WatchedWorkspaces { - name := ws.Name - if name == "" { - name = "-" - } - fmt.Fprintf(w, "%s\t%s\n", ws.ID, name) - } - return w.Flush() -} diff --git a/server/cmd/multica/main.go b/server/cmd/multica/main.go index 00f3c796..50699489 100644 --- a/server/cmd/multica/main.go +++ b/server/cmd/multica/main.go @@ -29,9 +29,6 @@ func init() { rootCmd.AddCommand(agentCmd) rootCmd.AddCommand(runtimeCmd) rootCmd.AddCommand(workspaceCmd) - rootCmd.AddCommand(watchCmd) - rootCmd.AddCommand(unwatchCmd) - rootCmd.AddCommand(watchesCmd) rootCmd.AddCommand(configCmd) rootCmd.AddCommand(statusCmd) rootCmd.AddCommand(versionCmd)