diff --git a/.gitignore b/.gitignore index 7309ddfcfb6b..0999f820bfaf 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ node_modules dist build npm-debug.log -.env \ No newline at end of file +.env +.idea/ diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 7f107784a510..00181abe169b 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -32,7 +32,7 @@ This Code of Conduct applies within all project spaces, and it also applies when ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [INSERT EMAIL ADDRESS]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@withfig.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership. @@ -40,4 +40,4 @@ Project maintainers who do not follow or enforce the Code of Conduct in good fai This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html -For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq \ No newline at end of file +For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq diff --git a/specs/brew.js b/specs/brew.js index f685bf8da3dc..b91c8936c588 100644 --- a/specs/brew.js +++ b/specs/brew.js @@ -25,6 +25,7 @@ var completionSpec = { { name: "update", description: "Fetch the newest version of Homebrew and all formulae" }, { name: "upgrade", description: "Upgrade outdated casks and outdated" }, { name: "search", description: "Perform a substring search of cask tokens and formula names" }, + { name: "config", description: "Show Homebrew and system configuration info" }, { name: "install", description: "Install ", diff --git a/specs/docker.js b/specs/docker.js index faeb9672f8e4..571832d14fef 100644 --- a/specs/docker.js +++ b/specs/docker.js @@ -1,42 +1,442 @@ +var generators = { + runningDockerContainers: { + script: `docker ps --format '{{ json . }}'`, + postProcess: function (out) { + let allLines = out.split('\n').map(JSON.parse); + return allLines.map(i => ({ + name: i.ID, + displayName: `${i.ID} (${i.Image})`, + })); + } + }, + allDockerContainers: { + script: `docker ps -a --format '{{ json . }}'`, + postProcess: function (out) { + let allLines = out.split('\n').map(JSON.parse); + return allLines.map(i => ({ + name: i.ID, + displayName: `${i.ID} (${i.Image})`, + })); + } + } +}; + var completionSpec = { name: "docker", description: "A self-sufficient runtime for containers", subcommands: [ - { name: "attach", description: "Attach local standard input, output, and error streams to a running container" }, - { name: "build", description: "Build an image from a Dockerfile" }, - { name: "commit", description: "Create a new image from a container's changes" }, - { name: "cp", description: "Copy files/folders between a container and the local filesystem" }, - { name: "create", description: "Create a new container" }, - { name: "diff", description: "Inspect changes to files or directories on a container's filesystem" }, - { name: "events", description: "Get real time events from the server" }, - { name: "exec", description: "Run a command in a running container" }, - { name: "export", description: "Export a container's filesystem as a tar archive" }, - { name: "history", description: "Show the history of an image" }, - { name: "images", description: "List images" }, - { name: "import", description: "Import the contents from a tarball to create a filesystem image" }, - { name: "info", description: "Display system-wide information" }, - { name: "inspect", description: "Return low-level information on Docker objects" }, - { name: "kill", description: "Kill one or more running containers" }, - { name: "load", description: "Load an image from a tar archive or STDIN" }, - { name: "login", description: "Log in to a Docker registry" }, - { name: "logout", description: "Log out from a Docker registry" }, - { name: "logs", description: "Fetch the logs of a container" }, - { name: "pause", description: "Pause all processes within one or more containers" }, - { name: "port", description: "List port mappings or a specific mapping for the container" }, - { name: "ps", description: "List containers" }, - { name: "pull", description: "Pull an image or a repository from a registry" }, - { name: "push", description: "Push an image or a repository to a registry" }, - { name: "rename", description: "Rename a container" }, - { name: "restart", description: "Restart one or more containers" }, - { name: "rm", description: "Remove one or more containers" }, - { name: "rmi", description: "Remove one or more images" }, + {name: "attach", description: "Attach local standard input, output, and error streams to a running container"}, + { + name: "build", + description: "Build an image from a Dockerfile", + args: { + name: "path", + generators: [ + { + template: 'folders' + } + ] + }, + options: [ + { + name: '--add-host', + args: { + name: "list", + description: "Add a custom host-to-IP mapping (host:ip)" + } + }, + { + name: '--build-arg', + args: { + name: "list", + description: "Set build-time variables" + } + }, + { + name: '--cache-from', + args: { + name: 'strings', + description: 'Images to consider as cache sources' + } + }, + { + name: '--disable-content-trust', + description: 'Skip image verification (default true)' + }, + { + name: ['-f', '--file'], + description: 'Name of the Dockerfile (Default is \'PATH/Dockerfile\')', + args: { + name: 'string', + generators: [{ + template: 'filepaths' + }] + } + }, + { + name: '--iidfile', + description: 'Write the image ID to the file', + args: { + name: 'string' + } + }, + { + name: '--isolation', + description: 'Container isolation technology', + args: { + name: 'string', + } + }, + { + name: '--label', + description: 'Set metadata for an image', + args: { + name: 'list' + } + }, + { + name: '--network', + description: 'Set the networking mode for the RUN instructions during build (default "default")', + args: { + name: 'string' + } + }, + { + name: '--no-cache', + description: 'Do not use cache when building the image' + }, + { + name: ['-o', '--output'], + description: 'Output destination (format: type=local,dest=path)', + args: { + name: 'stringArray' + } + }, + { + name: '--platform', + description: 'Set platform if server is multi-platform capable', + args: { + name: 'string' + } + }, + { + name: '--progress', + description: 'Set type of progress output (auto, plain, tty). Use plain to show container output', + args: { + name: 'string', + suggestions: ['auto', 'plain', 'tty'].map(i => ({name: i})) + } + }, + { + name: '--pull', + description: 'Always attempt to pull a newer version of the image' + }, + { + name: ['-q', '--quiet'], + description: 'Suppress the build output and print image ID on success' + }, + { + name: '--secret', + description: `Secret file to expose to the build (only if BuildKit enabled): id=mysecret,src=/local/secret`, + args: { + name: 'stringArray' + } + }, + { + name: '--squash', + description: 'Squash newly built layers into a single new layer' + }, + { + name: '--ssh', + description: `SSH agent socket or keys to expose to the build (only if BuildKit enabled) (format: default|[=|[,]])`, + args: { + name: 'stringArray' + } + }, + { + name: ['-t', '--tag'], + description: 'Name and optionally a tag in the \'name:tag\' format', + }, + { + name: '--target', + description: 'Set the target build stage to build', + args: { + name: 'target build stage', + generators: [{ + trigger: function () { + return true; + }, + script: function (context) { + let fileFlagIndex, dockerfilePath; + if (context.includes('-f')) { + fileFlagIndex = context.indexOf('-f'); + dockerfilePath = context[fileFlagIndex + 1]; + } else if (context.includes('--file')) { + fileFlagIndex = context.indexOf('--file'); + dockerfilePath = context[fileFlagIndex + 1]; + } else { + dockerfilePath = '$PWD/Dockerfile'; + } + + return `grep -iE 'FROM.*AS' "${dockerfilePath}"`; + }, + postProcess: function (out) { + // This just searches the Dockerfile for the alias name after AS, + // and due to the grep above, will only match lines where FROM and AS + // are on the same line. This could certainly be made more robust + // down the line. + let imageNameRegexp = /(?:[aA][sS]\s+)([\w:.-]+)/; + return out.split('\n').map(i => { + let result = imageNameRegexp.exec(i); + if (result) { + return { + name: result[1] + }; + } + }).filter(i => i !== undefined); + } + }] + } + } + ] + }, + {name: "commit", description: "Create a new image from a container's changes"}, + {name: "cp", description: "Copy files/folders between a container and the local filesystem"}, + {name: "create", description: "Create a new container"}, + {name: "diff", description: "Inspect changes to files or directories on a container's filesystem"}, + {name: "events", description: "Get real time events from the server"}, + {name: "exec", description: "Run a command in a running container"}, + {name: "export", description: "Export a container's filesystem as a tar archive"}, + {name: "history", description: "Show the history of an image"}, + { + name: "images", + description: "List images", + args: { + name: '[REPOSITORY[:TAG]]' + }, + options: [ + { + name: ['-a', '--all'], + description: 'Show all images (default hides intermediate images)' + }, + { + name: '--digests', + description: 'Show digests' + }, + { + name: ['-f', '--filter'], + description: 'Filter output based on conditions provided', + args: { + name: 'filter' + } + }, + { + name: '--format', + description: 'Pretty-print images using a Go template', + args: { + name: 'string' + } + }, + { + name: '--no-trunc', + description: "Don't truncate output" + }, + { + name: ['-q', '--quiet'], + description: 'Only show image IDs' + } + ] + }, + {name: "import", description: "Import the contents from a tarball to create a filesystem image"}, + {name: "info", description: "Display system-wide information"}, + { + name: "inspect", + description: "Return low-level information on Docker objects", + args: { + // TODO: There are more types of docker objects beyond running containers + // that can be inspected + name: "Name or ID", + generators: [ + { + script: `docker ps -a --format '{{ json . }}'`, + postProcess: function (out) { + let allLines = out.split('\n').map(JSON.parse); + return allLines.map(i => ({ + name: i.ID, + displayName: `[con] ${i.ID} (${i.Image})`, + })); + } + }, + { + script: `docker images -a --format '{{ json . }}'`, + postProcess: function (out) { + let allLines = out.split('\n').map(JSON.parse); + return allLines.map(i => { + let displayName; + if (i.Repository === "\u003cnone\u003e") { + displayName = i.ID; + } else { + displayName = i.Repository; + if (i.Tag !== "\u003cnone\u003e") { + displayName += `:${i.Tag}`; + } + } + + return { + name: i.ID, + displayName: `[img] ${displayName}` + }; + }); + } + }, + { + script: `docker volume ls --format '{{ json . }}'`, + postProcess: function (out) { + let allLines = out.split('\n').map(JSON.parse); + return allLines.map(i => ({ + name: i.Name, + displayName: `[vol] ${i.Name}`, + })); + } + } + ] + }, + options: [ + { + name: ['-f', '--format'], + description: 'Format the output using the given Go template', + args: { + name: 'string' + } + }, + { + name: ['-s', '--size'], + description: 'Display total file sizes if the type is container', + }, + { + name: '--type', + description: 'Return JSON for specified type', + args: { + name: 'string', + } + } + ] + }, + {name: "kill", description: "Kill one or more running containers"}, + {name: "load", description: "Load an image from a tar archive or STDIN"}, + {name: "login", description: "Log in to a Docker registry"}, + {name: "logout", description: "Log out from a Docker registry"}, + {name: "logs", description: "Fetch the logs of a container"}, + {name: "pause", description: "Pause all processes within one or more containers"}, + {name: "port", description: "List port mappings or a specific mapping for the container"}, + {name: "ps", description: "List containers"}, + {name: "pull", description: "Pull an image or a repository from a registry"}, + {name: "push", description: "Push an image or a repository to a registry"}, + {name: "rename", description: "Rename a container"}, + {name: "restart", description: "Restart one or more containers"}, + { + name: "rm", + description: "Remove one or more containers", + args: { + variadic: true, + name: 'containers', + suggestions: [ + { + name: '$(docker ps -aq)', + insertValue: '$(docker ps -aq)', + description: 'All containers, running and exited', + }, + { + name: "$(docker ps -q)", + insertValue: "$(docker ps -q)", + description: 'All running containers' + } + ], + generators: [ + generators.allDockerContainers, + ], + }, + options: [ + { + name: ['-f', '--force'], + description: 'Force the removal of a running container (uses SIGKILL)' + }, + { + name: ['-l', '--link'], + description: 'Remove the specified link' + }, + { + name: ['-v', '--volumes'], + description: 'Remove the anonymous volumes associated with the container' + } + ] + }, + { + name: "rmi", + description: "Remove one or more images", + args: { + variadic: true, + name: 'image', + suggestions: [ + { + name: '$(docker images -aq)', + insertValue: '$(docker images -aq)', + description: 'All images (including intermediate images)' + }, + { + name: '$(docker images -q)', + insertValue: '$(docker images -q)', + description: 'All non-intermediate images' + } + ], + generators: [ + { + script: `docker images -aq --format '{{ json . }}'`, + postProcess: function (out) { + let allLines = out.split('\n').map(JSON.parse); + return allLines.map(i => { + let displayName; + if (i.Repository === "\u003cnone\u003e") { + displayName = i.ID; + } else { + displayName = i.Repository; + if (i.Tag !== "\u003cnone\u003e") { + displayName += `:${i.Tag}`; + } + } + + return { + name: i.ID, + displayName: `${displayName} (${i.Size})` + }; + }); + } + } + ] + }, + options: [ + { + name: ['-f', '--force'], + description: 'Force removal of the image', + }, + { + name: '--no-prune', + description: 'Do not delete untagged parents' + } + ] + }, { name: "run", description: "Run a command in a new container", options: [ - { name: ["-i", "--interactive"], description: "Keep STDIN open even if not attached" }, - { name: ["-t", "--tty"], description: "Allocate a pseudo-TTY" }, - { name: ["-it"], insertValue: "-it ", description: "Launch an interactive session", icon: "fig://icon?type=commandkey" }, + {name: ["-i", "--interactive"], description: "Keep STDIN open even if not attached"}, + {name: ["-t", "--tty"], description: "Allocate a pseudo-TTY"}, + { + name: ["-it"], + insertValue: "-it ", + description: "Launch an interactive session", + icon: "fig://icon?type=commandkey" + }, ], args: [ { @@ -45,14 +445,14 @@ var completionSpec = { generators: { script: "docker images --format '{{.Repository}} {{.Size}} {{.Tag}} {{.ID}}'", postProcess: function (out) { - return out.split('\n').map(function (image) { - var _a = image.split(' '), repo = _a[0], size = _a[1], tag = _a[2], id = _a[3]; + return out.split('\n').map(image => { + let [repo, size, tag, id] = image.split(' ') return { name: repo, description: id + "@" + tag + " - " + size, icon: "fig://icon?type=docker" - }; - }); + } + }) } } }, @@ -62,32 +462,82 @@ var completionSpec = { } ] }, - { name: "save", description: "Save one or more images to a tar archive (streamed to STDOUT by default)" }, - { name: "search", description: "Search the Docker Hub for images" }, - { name: "start", description: "Start one or more stopped containers" }, - { name: "stats", description: "Display a live stream of container(s) resource usage statistics" }, - { name: "stop", description: "Stop one or more running containers" }, - { name: "tag", description: "Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE" }, - { name: "top", description: "Display the running processes of a container" }, - { name: "unpause", description: "Unpause all processes within one or more containers" }, - { name: "update", description: "Update configuration of one or more containers" }, - { name: "version", description: "Show the Docker version information" }, - { name: "wait", description: "Block until one or more containers stop, then print their exit codes" }, - { name: "builder", description: "Manage builds" }, - { name: "config", description: "Manage Docker configs" }, - { name: "container", description: "Manage containers" }, - { name: "context", description: "Manage contexts" }, - { name: "image", description: "Manage images" }, - { name: "network", description: "Manage networks" }, - { name: "node", description: "Manage Swarm nodes" }, - { name: "plugin", description: "Manage plugins" }, - { name: "secret", description: "Manage Docker secrets" }, - { name: "service", description: "Manage services" }, - { name: "stack", description: "Manage Docker stacks" }, - { name: "swarm", description: "Manage Swarm" }, - { name: "system", description: "Manage Docker" }, - { name: "trust", description: "Manage trust on Docker images" }, - { name: "volume", description: "Manage volumes" } + {name: "save", description: "Save one or more images to a tar archive (streamed to STDOUT by default)"}, + {name: "search", description: "Search the Docker Hub for images"}, + {name: "start", description: "Start one or more stopped containers"}, + {name: "stats", description: "Display a live stream of container(s) resource usage statistics"}, + { + name: "stop", + description: "Stop one or more running containers", + args: { + variadic: true, + name: 'container', + generators: [ + generators.runningDockerContainers, + ] + }, + options: [ + { + name: ['-t', '--t'], + description: 'Seconds to wait for stop before killing it (default 10)', + args: { + name: 'int' + } + } + ] + }, + {name: "tag", description: "Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE"}, + {name: "top", description: "Display the running processes of a container"}, + {name: "unpause", description: "Unpause all processes within one or more containers"}, + {name: "update", description: "Update configuration of one or more containers"}, + {name: "version", description: "Show the Docker version information"}, + {name: "wait", description: "Block until one or more containers stop, then print their exit codes"}, + {name: "builder", description: "Manage builds"}, + {name: "config", description: "Manage Docker configs"}, + {name: "container", description: "Manage containers"}, + {name: "context", description: "Manage contexts"}, + {name: "image", description: "Manage images"}, + {name: "network", description: "Manage networks"}, + {name: "node", description: "Manage Swarm nodes"}, + {name: "plugin", description: "Manage plugins"}, + {name: "secret", description: "Manage Docker secrets"}, + {name: "service", description: "Manage services"}, + {name: "stack", description: "Manage Docker stacks"}, + {name: "swarm", description: "Manage Swarm"}, + { + name: "system", + description: "Manage Docker", + subcommands: [ + { + name: 'prune', + description: 'Remove unused data', + options: [ + { + name: ['-a', '--all'], + description: 'Remove all unused images not just dangling ones' + }, + { + name: '--filter', + description: `Provide filter values (e.g. 'label==", + }, + { + name: ["--shallow-exclude"], + insertValue: "--shallow-exclude {cursor}", + args: { + name: 'revision', + }, + description: "Deepen or shorten the history of a shallow repository to exclude commits reachable from a specified remote branch or tag. This option can be specified multiple times", + }, + { + name: ["--unshallow"], + description: "If the source repository is shallow, fetch as much as possible so that the current repository has the same history as the source repository", + }, + { + name: ["--update-shallow"], + description: "By default when fetching from a shallow repository, git fetch refuses refs that require updating .git/shallow", + }, + { + name: ["--negotiation-tip"], + insertValue: "--negotiation-tip ", + args: { + name: 'commit|glob', + generators: generators.commits, + }, + description: "By default, Git will report, to the server, commits reachable from all local refs to find common commits in an attempt to reduce the size of the to-be-received packfile", + }, + { + name: ["--dry-run"], + description: "Show what would be done, without making any changes.", + }, + { + name: ["--write-fetch-head"], + description: "Write the list of remote refs fetched in the FETCH_HEAD file directly under $GIT_DIR. This is the default", + }, + { + name: ["--no-write-fetch-head"], + description: "tells Git not to write the file", + }, + { + name: ["-f", "--force"], + description: "This option overrides that check", + }, + { + name: ["-k", "--keep"], + description: "Keep downloaded pack.", + }, + { + name: ["--multiple"], + description: "Allow several and arguments to be specified. No s may be specified.", + }, + { + name: ["--auto-maintenance", "--auto-gc"], + description: "Run git maintenance run --auto at the end to perform automatic repository maintenance if", + }, + { + name: ["--no-auto-maintenance", "--no-auto-gc"], + description: "Don't run git maintenance run --auto at the end to perform automatic repository maintenance", + }, + { + name: ["--write-commit-graph"], + description: "Write a commit-graph after fetching. This overrides the config setting fetch.writeCommitGraph", + }, + { + name: ["--no-write-commit-graph"], + description: "Don't write a commit-graph after fetching. This overrides the config setting fetch.writeCommitGraph", + }, + { + name: ["-p", "--prune"], + description: "Before fetching, remove any remote-tracking references that no longer exist on the remote", + }, + { + name: ["-P", "--prune-tags"], + description: "Before fetching, remove any local tags that no longer exist on the remote if --prune is enabled", + }, + { + name: ["-n", "--no-tags"], + description: "By default, tags that point at objects that are downloaded from the remote repository are fetched and stored locally. This option disables this automatic tag following", + }, + { + name: ["--refmap"], + insertValue: "--refmap {cursor}", + args: { + name: 'refspec', + }, + description: "When fetching refs listed on the command line, use the specified refspec (can be given more than once) to map the refs to remote-tracking branches, instead of the values of remote.*.fetch configuration variables for the remote repository", + }, + { + name: ["-t", "--tags"], + description: "By default, tags that point at objects that are downloaded from the remote repository are fetched and stored locally. This option disables this automatic tag following", + }, + // TODO: fig needs to accept '=' as delimiter for args/options + // { + // name: ["--recurse-submodules"], + // insertValue: "--recurse-submodules={cursor}", + // args: { + // name: 'mode', + // suggestions: [ + // 'yes', 'on-demand', 'no', + // ], + // }, + // description: "When fetching refs listed on the command line, use the specified refspec (can be given more than once) to map the refs to remote-tracking branches, instead of the values of remote.*.fetch configuration variables for the remote repository", + // }, + { + name: ["-j", "--jobs"], + args: { + name: 'n', + }, + description: "Number of parallel children to be used for all forms of fetching.", + }, + { + name: ["--no-recurse-submodules"], + description: "Disable recursive fetching of submodules (this has the same effect as using the --recurse-submodules=no option).", + }, + { + name: ["--set-upstream"], + description: "If the remote is fetched successfully, add upstream (tracking) reference, used by argument-less git-pull[1] and other commands.", + }, + { + name: ["--submodule-prefix"], + insertValue: "--submodule-prefix {cursor}", + args: { + name: 'path', + }, + description: "Prepend to paths printed in informative messages such as \”Fetching submodule foo\". This option is used internally when recursing over submodules.", + }, + // TODO: fig needs to accept '=' as delimiter for args/options + // { + // name: ["--recurse-submodules-default"], + // insertValue: "--recurse-submodules-default={cursor}", + // args: { + // name: 'mode', + // suggestions: [ + // 'yes', 'on-demand', + // ], + // }, + // description: "This option is used internally to temporarily provide a non-negative default value for the --recurse-submodules option", + // }, + { + name: ["-u", "--update-head-ok"], + description: "By default git fetch refuses to update the head which corresponds to the current branch. This flag disables the check. This is purely for the internal use for git pull to communicate with git fetch, and unless you are implementing your own Porcelain you are not supposed to use it.", + }, + { + name: ["--upload-pack"], + insertValue: "--upload-pack {cursor}", + args: { + name: 'upload-pack', + }, + description: "When given, and the repository to fetch from is handled by git fetch-pack, --exec= is passed to the command to specify non-default path for the command run on the other end.", + }, + { + name: ["-q", "--quiet"], + description: "Pass --quiet to git-fetch-pack and silence any other internally used git commands. Progress is not reported to the standard error stream.", + }, + { + name: ["-v", "--verbose"], + description: "Be verbose.", + }, + { + name: ["--progress"], + description: "Progress status is reported on the standard error stream by default when it is attached to a terminal, unless -q is specified.", + }, + { + name: ["-o", "--server-option"], + args: { + name: 'option', + }, + description: "Transmit the given string to the server when communicating using protocol version 2. The given string must not contain a NUL or LF character. ", + }, + { + name: ["--show-forced-updates"], + description: "By default, git checks if a branch is force-updated during fetch. This can be disabled through fetch.showForcedUpdates, but the --show-forced-updates option guarantees this check occurs", + }, + { + name: ["--no-show-forced-updates"], + description: "By default, git checks if a branch is force-updated during fetch. Pass --no-show-forced-updates or set fetch.showForcedUpdates to false to skip this check for performance reasons.", + }, + { + name: ["-4", "--ipv4"], + description: "Use IPv4 addresses only, ignoring IPv6 addresses.", + }, + { + name: ["-6", "--ipv6"], + description: "Use IPv6 addresses only, ignoring IPv4 addresses.", + }, + { + name: "--stdin", + description: "Read refspecs, one per line, from stdin in addition to those provided as arguments. The \"tag \" format is not supported", + }, ] }, { diff --git a/specs/grep.js b/specs/grep.js index c4554522f04d..56922fd9383d 100644 --- a/specs/grep.js +++ b/specs/grep.js @@ -110,6 +110,17 @@ var completionSpec = { args: { name: "search pattern" } + }, + { + name: ["-V", "--version"], + description: "Print version number of grep to the standard output stream" + }, + { + name: ["-P", "--perl-regexp"], + description: "Interpret pattern as a Perl regular expression" + }, + { + name: ["-f"] } ] }; diff --git a/specs/jest.js b/specs/jest.js new file mode 100644 index 000000000000..685756351c7d --- /dev/null +++ b/specs/jest.js @@ -0,0 +1,382 @@ +var completionSpec = { + name: "jest", + description: + "A delightful JavaScript Testing Framework with a focus on simplicity", + args: {}, + options: [ + { + name: ["--bail", "-b"], + description: + "Exit the test suite immediately upon n number of failing test suite. Defaults to 1", + args: { + name: "n", + }, + }, + { + name: ["--cache"], + description: "Whether to use the cache", + }, + { + name: ["--no-cache"], + description: "Whether to use the cache", + }, + { + name: ["--changedFilesWithAncestor"], + description: + "Runs tests related to the current changes and the changes made in the last commit", + }, + { + name: ["--changedSince"], + description: + "Runs tests related to the changes since the provided branch or commit hash", + args: { + name: "since", + }, + }, + { + name: ["--ci"], + description: + "Instead of the regular behavior of storing a new snapshot automatically, will fail the test and require Jest to be run with --updateSnapshot", + }, + { + name: ["--clearCache"], + description: + "Deletes the Jest cache directory and then exits without running tests", + args: { + name: "cacheDirectory", + }, + }, + { + name: ["--collectCoverageFrom"], + displayName: "--collectCoverageFrom=", + insertValue: "--collectCoverageFrom=", + description: + "A glob pattern relative to rootDir matching the files that coverage info needs to be collected from", + args: { + name: "glob", + }, + }, + { + name: ["--colors"], + description: + "Forces test results output highlighting even if stdout is not a TTY", + }, + { + name: ["--config", "-c"], + displayName: "--config=", + insertValue: "--config=", + description: + "The path to a Jest config file specifying how to find and execute tests", + args: { + name: "path", + }, + }, + { + name: ["--coverage"], + displayName: "--coverage=", + insertValue: "--coverage=", + description: + "The path to a Jest config file specifying how to find and execute tests", + args: { + name: "true|false", + suggestions: [ + { + name: "true", + }, + { + name: "false", + }, + ], + }, + }, + { + name: ["--coverageProvider"], + displayName: "--coverageProvider=", + insertValue: "--coverageProvider=", + description: + "Indicates which provider should be used to instrument code for coverage", + args: { + name: "babel|v8", + suggestions: [{ name: "babel" }, { name: "v8" }], + }, + }, + { + name: ["--debug"], + description: "Print debugging info about your Jest config", + }, + { + name: ["--detectOpenHandles"], + description: + "Attempt to collect and print open handles preventing Jest from exiting cleanly", + }, + { + name: ["--env"], + displayName: "--env=", + insertValue: "--env=", + description: "The test environment used for all tests", + args: { + name: "jsdom|node|path/to/env.js", + suggestions: [{ name: "jsdom" }, { name: "node" }], + }, + }, + { + name: ["--errorOnDeprecated"], + description: "Make calling deprecated APIs throw helpful error messages", + }, + { + name: ["--expand", "-e"], + description: + "Use this flag to show full diffs and errors instead of a patch", + }, + { + name: ["--findRelatedTests"], + displayName: "--findRelatedTests ... ", + description: + "Find and run the tests that cover a space separated list of source files that were passed in as arguments", + args: { + name: " ... ", + }, + }, + { + name: ["--forceExit"], + description: "Force Jest to exit after all tests have completed running", + }, + { + name: ["--help"], + description: "Show the help information", + }, + { + name: ["--init"], + description: "Generate a basic configuration file", + }, + { + name: ["--injectGlobals"], + description: + "Insert Jest's globals (expect, test, describe, beforeEach etc.) into the global environment", + }, + { + name: ["--json"], + description: "Prints the test results in JSON", + }, + { + name: ["--outputFile"], + displayName: "--outputFile=", + insertValue: "--outputFile=", + description: + "Write test results to a file when the --json option is also specified", + args: { + name: "filename", + }, + }, + { + name: ["--lastCommit"], + description: + "Run all tests affected by file changes in the last commit made", + }, + { + name: ["--listTests"], + description: + "Lists all tests as JSON that Jest will run given the arguments, and exits", + }, + { + name: ["--logHeapUsage"], + description: "Logs the heap usage after every test", + }, + { + name: ["--maxConcurrency"], + displayName: "--maxConcurrency=", + insertValue: "--maxConcurrency=", + description: + "Prevents Jest from executing more than the specified amount of tests at the same time", + args: { + name: "num", + }, + }, + { + name: ["--maxWorkers", "-w"], + displayName: "--maxWorkers=|", + insertValue: "--maxWorkers=", + description: + "Specifies the maximum number of workers the worker-pool will spawn for running tests", + args: { + name: "|", + }, + }, + { + name: ["--noStackTrace"], + description: "Disables stack trace in test results output", + }, + { + name: ["--notify"], + description: "Activates notifications for test results", + }, + { + name: ["--onlyChanged", "-o"], + description: + "Attempts to identify which tests to run based on which files have changed in the current repository", + }, + { + name: ["--passWithNoTests"], + description: "Allows the test suite to pass when no files are found", + }, + { + name: ["--projects"], + displayName: "--projects ... ", + description: + "Run tests from one or more projects, found in the specified paths; also takes path globs", + args: { + name: " ... ", + }, + }, + { + name: ["--reporters"], + displayName: "--reporters=", + insertValue: "--reporters=", + description: "Run tests with specified reporters", + args: { + name: "reporter", + }, + }, + { + name: ["--roots"], + displayName: "--roots ... ", + description: + "A list of paths to directories that Jest should use to search for files in", + args: { + name: " ... ", + }, + }, + { + name: ["--runInBand", "-i"], + description: + "Run all tests serially in the current process, rather than creating a worker pool of child processes that run tests", + }, + { + name: ["--selectProjects"], + displayName: "--selectProjects ... ", + description: "Run only the tests of the specified projects", + args: { + name: " ... ", + }, + }, + { + name: ["--runTestsByPath"], + description: + "Run only the tests that were specified with their exact paths", + }, + { + name: ["--setupTestFrameworkScriptFile"], + displayName: "--setupTestFrameworkScriptFile=", + insertValue: "--setupTestFrameworkScriptFile=", + description: + "The path to a module that runs some code to configure or set up the testing framework before each test", + args: { + name: "file", + }, + }, + { + name: ["--showConfig"], + description: "Print your Jest config and then exits", + }, + { + name: ["--silent"], + description: "Prevent tests from printing messages through the console", + }, + { + name: ["--testNamePattern", "-t"], + displayName: "--testNamePattern=", + insertValue: "--testNamePattern=", + description: "Run only tests with a name that matches the regex", + args: { + name: "regex", + }, + }, + { + name: ["--testLocationInResults"], + description: "Adds a location field to test results", + }, + { + name: ["--testPathPattern"], + displayName: "--testPathPattern=", + insertValue: "--testPathPattern=", + description: + "A regexp pattern string that is matched against all tests paths before executing the test", + args: { + name: "regex", + }, + }, + { + name: ["--testPathIgnorePatterns"], + displayName: "--testPathIgnorePatterns=[array]", + insertValue: "--testPathIgnorePatterns=", + description: + "An array of regexp pattern strings that are tested against all tests paths before executing the test", + args: { + name: "[array]", + }, + }, + { + name: ["--testRunner"], + displayName: "--testRunner=", + insertValue: "--testRunner=", + description: "Lets you specify a custom test runner", + args: { + name: "path", + }, + }, + { + name: ["--testSequencer"], + displayName: "--testSequencer=", + insertValue: "--testSequencer=", + description: "Lets you specify a custom test sequencer", + args: { + name: "path", + }, + }, + { + name: ["--testTimeout"], + displayName: "--testTimeout=", + insertValue: "--testTimeout=", + description: "Default timeout of a test in milliseconds", + args: { + name: "timeout in ms", + }, + }, + { + name: ["--updateSnapshot", "-u"], + description: + "Use this flag to re-record every snapshot that fails during this test run", + }, + { + name: ["--useStderr"], + description: "Divert all output to stderr", + }, + { + name: ["--verbose"], + description: + "Display individual test results with the test suite hierarchy", + }, + { + name: ["--version", "-v"], + description: "Print the version and exit", + }, + { + name: ["--watch"], + description: + "Watch files for changes and rerun tests related to changed files", + }, + { + name: ["--watchAll"], + description: + "Watch files for changes and rerun all tests when something changes", + }, + { + name: ["--watchman"], + description: "Whether to use watchman for file crawling", + }, + { + name: ["--no-watchman"], + description: "Whether to use watchman for file crawling", + }, + ], +}; diff --git a/specs/vue.js b/specs/vue.js new file mode 100644 index 000000000000..1955d5df706d --- /dev/null +++ b/specs/vue.js @@ -0,0 +1,434 @@ +var completionSpec = { + name: "vue", + description: "vue cli tools", + subcommands: [ + { + name: "create", + description: "create a new project powered by vue-cli-service", + args: { + name: "app-name" + }, + options: [ + { + name: ["-p", "--preset"], + description: "Skip prompts and use saved or remote preset", + args: { + name: "presetName" + } + }, + { + name: ["-d", "--default"], + description: "Skip prompts and use default preset" + }, + { + name: ["-i", "--inlinePreset"], + description: "Skip prompts and use inline JSON string as preset", + args: { + name: "json" + } + }, + { + name: ["-m", "--packageManager"], + description: "Use specified npm client when installing dependencies", + args: { + name: "command" + } + }, + { + name: ["-r", "--registry"], + description: "Use specified npm registry when installing dependencies (only for npm)", + args: { + name: "url" + } + }, + { + name: ["-g", "--git"], + description: "Force git initialization with initial commit message", + args: { + name: "message", + } + }, + { + name: ["-n", "--no-git"], + description: "Skip git initialization" + }, + { + name: ["-f", "--force"], + description: "Overwrite target directory if it exists" + }, + { + name: "--merge", + description: "Merge target directory if it exists" + }, + { + name: ["-c", "--clone"], + description: "Use git clone when fetching remote preset" + }, + { + name: ["-X", "--proxy"], + description: "Use specified proxy when creating project", + args: { + name: "proxyUrl" + } + }, + { + name: ["-b", "--bar"], + description: "Scaffold project without beginner instructions" + }, + { + name: "--skipGetStarted", + description: "Skip displaying \"Get started\" instructions" + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ], + }, + { + name: "add", + description: "install a plugin and invoke its generator in an already created project", + args: { + name: "plugin", + }, + options: [ + { + name: "--registry", + description: "Use specified npm registry when installing dependencies (only for npm)", + args: { + name: "url" + } + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + }, + { + name: "invoke", + description: "invoke the generator of a plugin in an already created project", + args: { + name: "plugin", + }, + options: [ + { + name: "--registry", + description: "Use specified npm registry when installing dependencies (only for npm)", + args: { + name: "url" + } + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + }, + { + name: "inspect", + description: "inspect the webpack config in a project with vue-cli-service", + args: {}, + options: [ + { + name: "--mode", + args: { + name: "mode" + } + }, + { + name: "--rule", + description: "inspect a specific module rule", + args: { + name: "ruleName" + } + }, + { + name: "--plugin", + description: "inspect a specific plugin", + args: { + name: "pluginName" + } + }, + { + name: "--rules", + description: "list all module rule names" + }, + { + name: "--plugins", + description: "list all plugin names" + }, + { + name: ["-v", "--verbose"], + description: "Show full function definitions in output" + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + }, + { + name: "serve", + description: "serve a .js or .vue file in development mode with zero config", + args: { + template: "filepaths" + }, + options: [ + { + name: ["-o", "--open"], + description: "Open browser" + }, + { + name: ["-c", "--copy"], + description: "Copy local url to clipboard" + }, + { + name: ["-p", "--port"], + description: "Port used by the server (default: 8080 or next available port)", + args: { + name: "port" + } + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + }, + { + name: "build", + description: "build a .js or .vue file in production mode with zero config", + args: { + template: "filepaths" + }, + options: [ + { + name: ["-t", "--target"], + description: "Build target (app | lib | wc | wc-async, default: app)", + args: { + name: "target" + } + }, + { + name: ["-n", "--name"], + description: "name for lib or web-component mode (default: entry filename)", + args: { + name: "name" + } + }, + { + name: ["-d", "--destination"], + description: "output directory (default: dist)", + args: { + name: "dir" + } + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + }, + { + name: "ui", + description: "start and open the vue-cli ui", + options: [ + { + name: ["-H", "--host"], + description: "Host used for the UI server (default: localhost)", + args: { + name: "host" + } + }, + { + name: ["-p", "--port"], + description: "Port used for the UI server (by default search for available port)", + args: { + name: "port" + } + }, + { + name: ["-D", "--dev"], + description: "Run in dev mode" + }, + { + name: "--quiet", + description: "Don't output starting messages", + }, + { + name: "--headless", + description: "Don't open browser on start and output port" + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + }, + { + name: "init", + description: "generate a project from a remote template (legacy API, requires @vue/cli-init)", + args: [ + { + name: "template" + }, + { + name: "app-name" + } + ], + options: [ + { + name: ["-c", "--clone"], + description: "Use git clone when fetching remote template" + }, + { + name: "--offline", + description: "Use cached template" + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + }, + { + name: "config", + description: "inspect and modify the config", + args: { + name: "value" + }, + options: [ + { + name: ["-g", "--get"], + description: "get value from option", + args: { + name: "path" + } + }, + { + name: ["-s", "--set"], + description: "set option value", + args: { + name: "value" + } + }, + { + name: ["-d", "--delete"], + description: "delete option from config", + args: { + name: "path" + } + }, + { + name: ["-e", "--edit"], + description: "open config with default editor" + }, + { + name: "--json", + description: "outputs JSON result only" + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + }, + { + name: "outdated", + description: "(experimental) check for outdated vue cli service / plugins", + options: [ + { + name: "--next", + description: "Also check for alpha / beta / rc versions when upgrading" + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + }, + { + name: "upgrade", + description: "(experimental) upgrade vue cli service / plugins", + args: { + name: "plugin-name" + }, + options: [ + { + name: ["-t", "--to"], + description: "Upgrade to a version that is not latest", + args: { + name: "version" + } + }, + { + name: ["-f", "--from"], + description: "Skip probing installed plugin, assuming it is upgraded from the designated version", + args: { + name: "version" + } + }, + { + name: ["-r", "--registry"], + description: "Use specified npm registry when installing dependencies", + args: { + name: "url" + } + }, + { + name: "--all", + description: "Upgrade all plugins" + }, + { + name: "--next", + description: "Also check for alpha / beta /rc versions when upgrading" + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + }, + { + name: "migrate", + description: "(experimental) run migrator for an already-installed cli plugin", + args: { + name: "plugin-name" + }, + options: [ + { + name: ["-f", "--from"], + description: "The base version for the migrator to migrate from", + args: { + name: "version" + } + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + }, + { + name: "info", + description: "print debugging information about your environment", + options: [ + { + name: ["-h", "--help"], + description: "output usage information" + } + ] + } + ], + options: [ + { + name: ["-V", "--version"], + description: "output the version number" + }, + { + name: ["-h", "--help"], + description: "output usage information" + } + ] +} \ No newline at end of file diff --git a/specs/xcode-select.js b/specs/xcode-select.js new file mode 100644 index 000000000000..8a2a9a12d294 --- /dev/null +++ b/specs/xcode-select.js @@ -0,0 +1,28 @@ +var completionSpec = { + name: "xcode-select", + description: "Active developer directory for Xcode tools", + options: [{ + name: ["-h", "--help"], + description: "Help message" + }, { + name: ["-p", "--print-path"], + description: "Display path to active developer directory" + }, { + name: ["-s", "--switch"], + description: "Set path to active developer directory", + insertValue: "-s ", + args: { + name: "path", + template: "folders" + } + }, { + name: ["--install"], + description: "Install Xcode command line tools" + }, { + name: ["-v", "--version"], + description: "Display version" + }, { + name: ["-r", "--reset"], + description: "Reset to the default CLT path" + }] +}