Created
November 12, 2017 15:16
-
-
Save kbrandwijk/ea94cc9f7a676a9adde8c4179db6f634 to your computer and use it in GitHub Desktop.
Graphcool autocomplete for clink/cmder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- For clink, place this file in one of the folders described here: | |
-- https://github.com/mridgers/clink/blob/master/docs/clink.md#file-locations | |
-- For cmder, place this file in the cmder config folder | |
local parser = clink.arg.new_parser | |
local no_options_parser = parser({}) | |
local target_options = { | |
"--target" .. parser({ "<name_of_target>" }), | |
"-t" .. parser({ "<name_of_target>" }), | |
} | |
local function_options = { | |
"-f" .. parser({ "<name_of_function>" }), | |
"--function" .. parser({ "<name_of_function>" }), | |
} | |
local force_options = { | |
"-f" .. no_options_parser, | |
"--force" .. no_options_parser, | |
} | |
local init_parser = parser({ | |
"--copy" .. parser({ "<service_id_or_alias>" }), | |
"-c" .. parser({ "<service_id_or_alias>" }), | |
"--force" .. no_options_parser, | |
"-f" .. no_options_parser, | |
}) | |
local target_parser = parser({ | |
{target_options} | |
}) | |
local login_parser = parser({ | |
"--token".. parser({ "<system_token>" }), | |
"-T".. parser({ "<system_token>" }), | |
}) | |
local clustername_parser = parser({ | |
"-n" .. parser({ "<name_of_cluster>" }), | |
"--name" .. parser({ "<name_of_cluster>" }), | |
}) | |
local local_parser = parser({ | |
"eject" .. no_options_parser, | |
"ps" .. clustername_parser, | |
"pull" .. clustername_parser, | |
"restart" .. clustername_parser, | |
"stop" .. clustername_parser, | |
"up" .. clustername_parser, | |
}) | |
local invoke_parser = parser({ | |
{function_options}, | |
"-j", | |
"--json", | |
"-l" .. no_options_parser, | |
"--lastEvent" .. no_options_parser, | |
{target_options}, | |
}) | |
local delete_parser = parser({ | |
{target_options}, | |
{force_options}, | |
}) | |
local logs_parser = parser({ | |
{function_options}, | |
{target_options}, | |
"--tail" .. no_options_parser, | |
}) | |
local root_token_parser = parser({ | |
{target_options}, | |
"<name_of_token>", | |
}) | |
local playground_parser = parser({ | |
{target_options}, | |
"-w" .. no_options_parser, | |
"--web" .. no_options_parser, | |
}) | |
local deploy_parser = parser({ | |
"-a" .. parser({ "<name_of_alias>" }), | |
"--alias" .. parser({ "<name_of_alias>" }), | |
"-D" .. no_options_parser, | |
"--default" .. no_options_parser, | |
"-d" .. no_options_parser, | |
"--dry-run" .. no_options_parser, | |
{force_options}, | |
"-i" .. no_options_parser, | |
"--interactive" .. no_options_parser, | |
"-j" .. no_options_parser, | |
"--json" .. no_options_parser, | |
"-n" .. parser({ "<name_of_service>" }), | |
"--new-service".. parser({ "<name_of_service>" }), | |
"-c" .. parser({ "<name_of_cluster>" }), | |
"--new-service-cluster" .. parser({ "<name_of_cluster>" }), | |
{target_options}, | |
"-w" .. no_options_parser, | |
"--watch" .. no_options_parser, | |
}) | |
local help_local_parser = parser({ | |
"eject" .. no_options_parser, | |
"ps" .. no_options_parser, | |
"pull" .. no_options_parser, | |
"restart" .. no_options_parser, | |
"stop" .. no_options_parser, | |
"up" .. no_options_parser, | |
}) | |
local help_parser = parser({ | |
"init" .. no_options_parser, | |
"deploy" .. no_options_parser, | |
"playground" .. no_options_parser, | |
"info" .. no_options_parser, | |
"list" .. no_options_parser, | |
"ls" .. no_options_parser, | |
"root-token" .. no_options_parser, | |
"logs" .. no_options_parser, | |
"delete" .. no_options_parser, | |
"add-template" .. no_options_parser, | |
"invoke-local" .. no_options_parser, | |
"reset" .. no_options_parser, | |
"local" .. help_local_parser, | |
"login" .. no_options_parser, | |
"console" .. no_options_parser, | |
"account" .. no_options_parser, | |
}) | |
local graphcool_parser = parser({ | |
"help" .. help_parser, | |
"init" .. init_parser, | |
"deploy" .. deploy_parser, | |
"playground" .. playground_parser, | |
"info" .. target_parser, | |
"list" .. no_options_parser, | |
"ls" .. no_options_parser, | |
"root-token" .. root_token_parser, | |
"logs" .. logs_parser, | |
"delete" .. delete_parser, | |
"add-template" .. parser({ "<name_of_template>" }), | |
"invoke-local" .. invoke_parser, | |
"reset" .. target_parser, | |
"local" .. local_parser, | |
"login" .. login_parser, | |
"console" .. target_parser, | |
"account" .. no_options_parser, | |
}) | |
clink.arg.register_parser("graphcool", graphcool_parser) | |
clink.arg.register_parser("gc", graphcool_parser) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment