aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_help.cpp
blob: 27dc168a41c22005fc9fde7cd06ebae0aad2b2b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "vcpkg_Commands.h"
#include "vcpkg.h"
#include "vcpkg_System.h"

namespace vcpkg
{
    void version_command(const vcpkg_cmd_arguments& args)
    {
        args.check_exact_arg_count(0);
        System::println("Vcpkg package management program version %s\n"
                        "\n"
                        "Vcpkg is provided \"as-is\" without warranty of any kind, express or implied.\n"
                        "All rights reserved.", vcpkg::version()
        );
        exit(EXIT_SUCCESS);
    }

    void help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
    {
        args.check_max_arg_count(1);
        if (args.command_arguments.empty())
        {
            print_usage();
            exit(EXIT_SUCCESS);
        }
        const auto& topic = args.command_arguments[0];
        if (topic == "triplet")
        {
            help_topic_valid_triplet(paths);
        }
        else
        {
            System::println(System::color::error, "Error: unknown topic %s", topic);
            print_usage();
            exit(EXIT_FAILURE);
        }
        exit(EXIT_SUCCESS);
    }

    void contact_command(const vcpkg_cmd_arguments& args)
    {
        args.check_exact_arg_count(0);
        System::println("Send an email to vcpkg@microsoft.com with any feedback.");
        exit(EXIT_SUCCESS);
    }

    void help_topic_valid_triplet(const vcpkg_paths& paths)
    {
        System::println("Available architecture triplets:");
        auto it = fs::directory_iterator(paths.triplets);
        for (; it != fs::directory_iterator(); ++it)
        {
            System::println("  %s", it->path().stem().filename().string());
        }
    }
}