refactor(cli): move watch/unwatch under workspace subcommand
Reduces top-level command clutter by nesting watch/unwatch as workspace subcommands. Removes redundant `watches` command since `workspace list` already shows watched status. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8a1067e2aa
commit
87b482e73c
3 changed files with 8 additions and 38 deletions
|
|
@ -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 <workspace-id> # Add a workspace to the watch list
|
||||
multica unwatch <workspace-id> # Remove a workspace from the watch list
|
||||
multica watches # Show the current watch list
|
||||
multica workspace watch <workspace-id> # Add a workspace to the watch list
|
||||
multica workspace unwatch <workspace-id> # 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 <workspace-id>
|
||||
multica workspace watch <workspace-id>
|
||||
|
||||
# 3. Start the daemon
|
||||
multica daemon
|
||||
|
|
|
|||
|
|
@ -23,28 +23,24 @@ var workspaceListCmd = &cobra.Command{
|
|||
RunE: runWorkspaceList,
|
||||
}
|
||||
|
||||
var watchCmd = &cobra.Command{
|
||||
var workspaceWatchCmd = &cobra.Command{
|
||||
Use: "watch <workspace-id>",
|
||||
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 <workspace-id>",
|
||||
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 <id>' 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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue