winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

SourceCommand.h (4463B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include "Command.h"
      5 
      6 namespace AppInstaller::CLI
      7 {
      8     struct SourceCommand final : public Command
      9     {
     10         SourceCommand(std::string_view parent) : Command("source", parent) {}
     11 
     12         std::vector<std::unique_ptr<Command>> GetCommands() const override;
     13 
     14         Resource::LocString ShortDescription() const override;
     15         Resource::LocString LongDescription() const override;
     16 
     17         Utility::LocIndView HelpLink() const override;
     18 
     19     protected:
     20         void ExecuteInternal(Execution::Context& context) const override;
     21     };
     22 
     23     struct SourceAddCommand final : public Command
     24     {
     25         SourceAddCommand(std::string_view parent) : Command("add", {}, parent, Settings::TogglePolicy::Policy::AllowedSources) {}
     26 
     27         std::vector<Argument> GetArguments() const override;
     28 
     29         Resource::LocString ShortDescription() const override;
     30         Resource::LocString LongDescription() const override;
     31 
     32         Utility::LocIndView HelpLink() const override;
     33 
     34     protected:
     35         void ValidateArgumentsInternal(Execution::Args& execArgs) const override;
     36         void ExecuteInternal(Execution::Context& context) const override;
     37     };
     38 
     39     struct SourceListCommand final : public Command
     40     {
     41         SourceListCommand(std::string_view parent) : Command("list", { "ls" }, parent) {}
     42 
     43         std::vector<Argument> GetArguments() const override;
     44 
     45         Resource::LocString ShortDescription() const override;
     46         Resource::LocString LongDescription() const override;
     47 
     48         void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;
     49 
     50         Utility::LocIndView HelpLink() const override;
     51 
     52     protected:
     53         void ExecuteInternal(Execution::Context& context) const override;
     54     };
     55 
     56     struct SourceUpdateCommand final : public Command
     57     {
     58         SourceUpdateCommand(std::string_view parent) : Command("update", { "refresh" }, parent) {}
     59 
     60         std::vector<Argument> GetArguments() const override;
     61 
     62         Resource::LocString ShortDescription() const override;
     63         Resource::LocString LongDescription() const override;
     64 
     65         void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;
     66 
     67         Utility::LocIndView HelpLink() const override;
     68 
     69     protected:
     70         void ExecuteInternal(Execution::Context& context) const override;
     71     };
     72 
     73     struct SourceRemoveCommand final : public Command
     74     {
     75         // We can remove user or default sources, so this is not gated by any single policy.
     76         SourceRemoveCommand(std::string_view parent) : Command("remove", { "rm" }, parent) {}
     77 
     78         std::vector<Argument> GetArguments() const override;
     79 
     80         Resource::LocString ShortDescription() const override;
     81         Resource::LocString LongDescription() const override;
     82 
     83         void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;
     84 
     85         Utility::LocIndView HelpLink() const override;
     86 
     87     protected:
     88         void ExecuteInternal(Execution::Context& context) const override;
     89     };
     90 
     91     struct SourceResetCommand final : public Command
     92     {
     93         SourceResetCommand(std::string_view parent) : Command("reset", parent) {}
     94 
     95         std::vector<Argument> GetArguments() const override;
     96 
     97         Resource::LocString ShortDescription() const override;
     98         Resource::LocString LongDescription() const override;
     99 
    100         void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;
    101 
    102         Utility::LocIndView HelpLink() const override;
    103 
    104     protected:
    105         void ExecuteInternal(Execution::Context& context) const override;
    106     };
    107 
    108     struct SourceExportCommand final : public Command
    109     {
    110         SourceExportCommand(std::string_view parent) : Command("export", parent, CommandOutputFlags::IgnoreSettingsWarnings) {}
    111 
    112         std::vector<Argument> GetArguments() const override;
    113 
    114         Resource::LocString ShortDescription() const override;
    115         Resource::LocString LongDescription() const override;
    116 
    117         void Complete(Execution::Context& context, Execution::Args::Type valueType) const override;
    118 
    119         Utility::LocIndView HelpLink() const override;
    120 
    121     protected:
    122         void ExecuteInternal(Execution::Context& context) const override;
    123     };
    124 }