| 886 | } |
| 887 | |
| 888 | func (c *DocsUpdateCmd) dryRunPayload(docID string, written int, replacing bool, replaceStart, replaceEnd int64, at string) map[string]any { |
| 889 | var index any = docsAtIndexEnd |
| 890 | switch { |
| 891 | case replacing: |
| 892 | index = replaceStart |
| 893 | case at != "": |
| 894 | index = docsAtIndexAnchorStart |
| 895 | case c.Index > 0: |
| 896 | index = c.Index |
| 897 | } |
| 898 | payload := map[string]any{ |
| 899 | "document_id": docID, |
| 900 | "written": written, |
| 901 | "index": index, |
| 902 | "markdown": c.Markdown, |
| 903 | "pageless": c.Pageless, |
| 904 | "tab": c.Tab, |
| 905 | "segment": c.Segment, |
| 906 | "batch": c.Batch, |
| 907 | } |
| 908 | if replacing { |
| 909 | payload["replaceRange"] = map[string]int64{"start": replaceStart, "end": replaceEnd} |
| 910 | } |
| 911 | addDocsAtAnchorDryRunPayload(payload, docsAtAnchorFlags{At: at, Occurrence: c.Occurrence, MatchCase: c.MatchCase}) |
| 912 | return payload |
| 913 | } |
| 914 | |
| 915 | type DocsInsertCmd struct { |
| 916 | DocID string `arg:"" name:"docId" help:"Doc ID"` |