()
| 12 | const FlagFile = "file" |
| 13 | |
| 14 | func NewCreateCmd() *cobra.Command { |
| 15 | cmd := &cobra.Command{ |
| 16 | Use: "create <subject_namespace>:<subject_id> <relation> <object_namespace>:<object_id>", |
| 17 | Short: "Create relationship tuples from inline arguments or JSON files and folders", |
| 18 | Long: "Create relationship tuples from inline arguments or JSON files and folders.\n\n" + |
| 19 | "Inline example:\n" + |
| 20 | " keto relation-tuple create User:alice owner Doc:readme\n\n" + |
| 21 | |
| 22 | "From file or folder:\n" + |
| 23 | " keto relation-tuple create -f relationships1.json -f relationships2.json\n" + |
| 24 | " keto relation-tuple create -f relationships-dir1 -f relationships-dir2\n\n" + |
| 25 | |
| 26 | "If a directory is provided, all JSON files inside it are processed.\n" + |
| 27 | "Use '-' as filename to read from STD_IN:\n" + |
| 28 | " keto relation-tuple create -f -", |
| 29 | Args: cobra.ArbitraryArgs, |
| 30 | RunE: transactTuples(rts.RelationTupleDelta_ACTION_INSERT), |
| 31 | } |
| 32 | |
| 33 | registerFileFlag(cmd.Flags()) |
| 34 | registerPackageFlags(cmd.Flags()) |
| 35 | |
| 36 | return cmd |
| 37 | } |
no test coverage detected