docs(cron): show how to view scheduled tasks
This commit is contained in:
parent
c68b4f3903
commit
efdbc988c2
4 changed files with 31 additions and 4 deletions
14
README.md
14
README.md
|
|
@ -1409,6 +1409,20 @@ PicoClaw supports scheduled reminders and recurring tasks through the `cron` too
|
||||||
* **Recurring tasks**: "Remind me every 2 hours" → triggers every 2 hours
|
* **Recurring tasks**: "Remind me every 2 hours" → triggers every 2 hours
|
||||||
* **Cron expressions**: "Remind me at 9am daily" → uses cron expression
|
* **Cron expressions**: "Remind me at 9am daily" → uses cron expression
|
||||||
|
|
||||||
|
To view your scheduled tasks:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
picoclaw cron list
|
||||||
|
```
|
||||||
|
|
||||||
|
Useful follow-up commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
picoclaw cron disable 1 # pause job 1
|
||||||
|
picoclaw cron enable 1 # resume job 1
|
||||||
|
picoclaw cron remove 1 # delete job 1
|
||||||
|
```
|
||||||
|
|
||||||
Jobs are stored in `~/.picoclaw/workspace/cron/` and processed automatically.
|
Jobs are stored in `~/.picoclaw/workspace/cron/` and processed automatically.
|
||||||
|
|
||||||
## 🤝 Contribute & Roadmap
|
## 🤝 Contribute & Roadmap
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,14 @@ func NewCronCommand() *cobra.Command {
|
||||||
Use: "cron",
|
Use: "cron",
|
||||||
Aliases: []string{"c"},
|
Aliases: []string{"c"},
|
||||||
Short: "Manage scheduled tasks",
|
Short: "Manage scheduled tasks",
|
||||||
Args: cobra.NoArgs,
|
Long: `Manage scheduled tasks.
|
||||||
|
|
||||||
|
Use 'picoclaw cron list' to view all jobs currently scheduled in your workspace.`,
|
||||||
|
Example: `picoclaw cron list
|
||||||
|
picoclaw cron add "Daily standup" "0 9 * * 1-5"
|
||||||
|
picoclaw cron disable 1
|
||||||
|
picoclaw cron remove 1`,
|
||||||
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||||
return cmd.Help()
|
return cmd.Help()
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ func TestNewCronCommand(t *testing.T) {
|
||||||
require.NotNil(t, cmd)
|
require.NotNil(t, cmd)
|
||||||
|
|
||||||
assert.Equal(t, "Manage scheduled tasks", cmd.Short)
|
assert.Equal(t, "Manage scheduled tasks", cmd.Short)
|
||||||
|
assert.Contains(t, cmd.Long, "picoclaw cron list")
|
||||||
|
assert.Contains(t, cmd.Example, "picoclaw cron list")
|
||||||
|
|
||||||
assert.Len(t, cmd.Aliases, 1)
|
assert.Len(t, cmd.Aliases, 1)
|
||||||
assert.True(t, cmd.HasAlias("c"))
|
assert.True(t, cmd.HasAlias("c"))
|
||||||
|
|
@ -46,6 +48,9 @@ func TestNewCronCommand(t *testing.T) {
|
||||||
|
|
||||||
assert.Len(t, subcmd.Aliases, 0)
|
assert.Len(t, subcmd.Aliases, 0)
|
||||||
assert.False(t, subcmd.Hidden)
|
assert.False(t, subcmd.Hidden)
|
||||||
|
if subcmd.Name() == "list" {
|
||||||
|
assert.Contains(t, subcmd.Example, "picoclaw cron list")
|
||||||
|
}
|
||||||
|
|
||||||
assert.False(t, subcmd.HasSubCommands())
|
assert.False(t, subcmd.HasSubCommands())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,10 @@ import "github.com/spf13/cobra"
|
||||||
|
|
||||||
func newListCommand(storePath func() string) *cobra.Command {
|
func newListCommand(storePath func() string) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "List all scheduled jobs",
|
Short: "List all scheduled jobs",
|
||||||
Args: cobra.NoArgs,
|
Example: `picoclaw cron list`,
|
||||||
|
Args: cobra.NoArgs,
|
||||||
RunE: func(_ *cobra.Command, _ []string) error {
|
RunE: func(_ *cobra.Command, _ []string) error {
|
||||||
cronListCmd(storePath())
|
cronListCmd(storePath())
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue