validContextMode keeps the model from creating a context in a bogus mode.
(mode string)
| 54 | |
| 55 | // validContextMode keeps the model from creating a context in a bogus mode. |
| 56 | func validContextMode(mode string) (ctxmgr.ProcessingMode, bool) { |
| 57 | switch ctxmgr.ProcessingMode(strings.ToLower(strings.TrimSpace(mode))) { |
| 58 | case ctxmgr.ModeFull: |
| 59 | return ctxmgr.ModeFull, true |
| 60 | case ctxmgr.ModeSummary: |
| 61 | return ctxmgr.ModeSummary, true |
| 62 | case ctxmgr.ModeChunked: |
| 63 | return ctxmgr.ModeChunked, true |
| 64 | case ctxmgr.ModeSmart: |
| 65 | return ctxmgr.ModeSmart, true |
| 66 | case ctxmgr.ModeKnowledge, "": |
| 67 | return ctxmgr.ModeKnowledge, true |
| 68 | default: |
| 69 | return "", false |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | // Create builds and persists a context from the given sources. |
| 74 | func (a *contextPluginAdapter) Create(name, mode string, paths []string, description string, force bool) (string, error) { |
no test coverage detected