CompletionFlow.h (2842B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include "ExecutionContext.h" 5 #include "WorkflowBase.h" 6 #include <winget/RepositorySearch.h> 7 8 namespace AppInstaller::CLI::Workflow 9 { 10 // Outputs completion possibilities for the source name argument. 11 // Required Args: None 12 // Inputs: CompletionData 13 // Outputs: None 14 void CompleteSourceName(Execution::Context& context); 15 16 // Terminates the context if the completion word is empty. 17 // Required Args: None 18 // Inputs: CompletionData 19 // Outputs: None 20 void RequireCompletionWordNonEmpty(Execution::Context& context); 21 22 // Outputs the matched field for the results. 23 // Required Args: None 24 // Inputs: SearchResult 25 // Outputs: None 26 void CompleteWithMatchedField(Execution::Context& context); 27 28 // Outputs the versions available for the single search result. 29 // Required Args: None 30 // Inputs: CompletionData, SearchResult 31 // Outputs: None 32 void CompleteWithSearchResultVersions(Execution::Context& context); 33 34 // Outputs the channels available for the single search result. 35 // Required Args: None 36 // Inputs: CompletionData, SearchResult 37 // Outputs: None 38 void CompleteWithSearchResultChannels(Execution::Context& context); 39 40 // Executes the appropriate completion flow for the given argument in the context of a command 41 // that targets a single manifest (ex. show or install). 42 // Required Args: None 43 // Inputs: CompletionData 44 // Outputs: None 45 struct CompleteWithSingleSemanticsForValue : public WorkflowTask 46 { 47 CompleteWithSingleSemanticsForValue(Execution::Args::Type type) : WorkflowTask("CompleteWithSingleSemanticsForValue"), m_type(type) {} 48 49 void operator()(Execution::Context& context) const override; 50 51 private: 52 Execution::Args::Type m_type; 53 }; 54 55 // Executes the appropriate completion flow for the given argument in the context of a command 56 // that targets a single manifest (ex. show or install), using the already open source. 57 // Required Args: None 58 // Inputs: CompletionData, Source 59 // Outputs: None 60 struct CompleteWithSingleSemanticsForValueUsingExistingSource : public WorkflowTask 61 { 62 CompleteWithSingleSemanticsForValueUsingExistingSource(Execution::Args::Type type) : WorkflowTask("CompleteWithSingleSemanticsForValueUsingExistingSource"), m_type(type) {} 63 64 void operator()(Execution::Context& context) const override; 65 66 private: 67 Execution::Args::Type m_type; 68 }; 69 70 // Outputs an empty line to indicate that there are no completions. 71 // Required Args: None 72 // Inputs: None 73 // Outputs: None 74 void CompleteWithEmptySet(Execution::Context& context); 75 }