CompletionData.h (1010B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include "ExecutionArgs.h" 5 #include "Invocation.h" 6 7 #include <memory> 8 #include <string> 9 #include <string_view> 10 #include <vector> 11 12 13 namespace AppInstaller::CLI 14 { 15 // Data created by CompleteCommand to be consumed by other commands in order 16 // to provide context sensitive results. 17 struct CompletionData 18 { 19 CompletionData(std::string_view word, std::string_view commandLine, std::string_view position); 20 21 const std::string& Word() const { return m_word; } 22 Invocation& BeforeWord() const { return *m_argsBeforeWord; } 23 Invocation& AfterWord() const { return *m_argsAfterWord; } 24 25 private: 26 static void ParseInto(std::string_view line, std::vector<std::string>& args, bool skipFirst); 27 28 std::string m_word; 29 std::unique_ptr<CLI::Invocation> m_argsBeforeWord; 30 std::unique_ptr<CLI::Invocation> m_argsAfterWord; 31 }; 32 }