intake/cmd/action.go

35 lines
1.3 KiB
Go
Raw Normal View History

2025-01-21 16:42:59 +00:00
package cmd
import (
"github.com/spf13/cobra"
)
var actionCmd = &cobra.Command{
Use: "action",
Short: "Manage and run source actions",
Long: `Add, edit, delete, and run source actions on items.
A feed source is updated by the "fetch" action, which receives no input and
returns one JSON item per line on stdout. Other source actions are run on a
specific item, receiving that item on stdin and expecting that item, with any
modifications made by the action, on stdout.
Items declare support for an action by having an "action" key containing an
object with a key for every supported action. The value of that key may be
any arbitrary JSON value. Use --force to execute an unsupported action anyway,
2025-01-24 23:41:52 +00:00
though the action may fail if it operates on the item's action data.
The special action "on_create" is always run when an item is first returned
by a fetch. The item does not need to declare support for "on_create". This
action is not accessible through the web interface, so if you need to retry
the action, you need another action with the same command as "on_create".
If an item's "on_create" fails, the item is still created, but without any
changes from the "on_create", if any.
To execute the "fetch" action, use "intake source fetch".`,
2025-01-21 16:42:59 +00:00
}
func init() {
rootCmd.AddCommand(actionCmd)
}