use dynamic completion but it seems we should use cache
This commit is contained in:
parent
2fdd13ab92
commit
e118561a37
172
src/_mix
172
src/_mix
|
|
@ -393,109 +393,81 @@ _mix() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_mix_tasks() {
|
_mix_tasks() {
|
||||||
# mix help | \grep -vE 'phx\.|hex\.' | perl -wln -e 'm{^mix (\S+)\s+#\s+(.+)} and print qq("$1:$2")'
|
local -a mix_tasks=()
|
||||||
# mix compile --list | perl -wln -e 'm{^mix (\S+)\s+#\s+(.+)} and print qq("$1:$2")'
|
if (( $+commands[perl] )); then
|
||||||
local -a mix_tasks=(
|
mix_tasks=(${(f)"$(mix help | perl -lne 'm{^mix (\S+)\s+#\s+(.+)} and print qq($1:$2)')"})
|
||||||
"app.config:Configures all registered apps"
|
else
|
||||||
"app.start:Starts all registered apps"
|
local -a builtin_tasks=(
|
||||||
"app.tree:Prints the application tree"
|
"app.config:Configures all registered apps"
|
||||||
"archive:Lists installed archives"
|
"app.start:Starts all registered apps"
|
||||||
"archive.build:Archives this project into a .ez file"
|
"app.tree:Prints the application tree"
|
||||||
"archive.install:Installs an archive locally"
|
"archive:Lists installed archives"
|
||||||
"archive.uninstall:Uninstalls archives"
|
"archive.build:Archives this project into a .ez file"
|
||||||
"clean:Deletes generated application files"
|
"archive.install:Installs an archive locally"
|
||||||
"cmd:Executes the given command"
|
"archive.uninstall:Uninstalls archives"
|
||||||
"compile:Compiles source files"
|
"clean:Deletes generated application files"
|
||||||
"compile.app:Writes a '.app' file"
|
"cmd:Executes the given command"
|
||||||
"compile.elixir:Compiles Elixir source files"
|
"compile:Compiles source files"
|
||||||
"compile.erlang:Compiles Erlang source files"
|
"compile.app:Writes a '.app' file"
|
||||||
"compile.leex:Compiles Leex source files"
|
"compile.elixir:Compiles Elixir source files"
|
||||||
"compile.yecc:Compiles Yecc source files"
|
"compile.erlang:Compiles Erlang source files"
|
||||||
"deps:Lists dependencies and their status"
|
"compile.leex:Compiles Leex source files"
|
||||||
"deps.clean:Deletes the given dependencies' files"
|
"compile.yecc:Compiles Yecc source files"
|
||||||
"deps.compile:Compiles dependencies"
|
"deps:Lists dependencies and their status"
|
||||||
"deps.get:Fetches unavailable and out of date dependencies"
|
"deps.clean:Deletes the given dependencies' files"
|
||||||
"deps.tree:Prints the dependency tree"
|
"deps.compile:Compiles dependencies"
|
||||||
"deps.unlock:Unlocks the given dependencies"
|
"deps.get:Fetches unavailable and out of date dependencies"
|
||||||
"deps.update:Updates the given dependencies"
|
"deps.tree:Prints the dependency tree"
|
||||||
"do:Executes the tasks separated by plus"
|
"deps.unlock:Unlocks the given dependencies"
|
||||||
"escript:Lists installed escripts"
|
"deps.update:Updates the given dependencies"
|
||||||
"escript.build:Builds an escript for the project"
|
"do:Executes the tasks separated by plus"
|
||||||
"escript.install:Installs an escript locally"
|
"escript:Lists installed escripts"
|
||||||
"escript.uninstall:Uninstalls escripts"
|
"escript.build:Builds an escript for the project"
|
||||||
"eval:Evaluates the given code"
|
"escript.install:Installs an escript locally"
|
||||||
"format:Formats the given files/patterns"
|
"escript.uninstall:Uninstalls escripts"
|
||||||
"help:Prints help information for tasks, aliases, modules, and applications"
|
"eval:Evaluates the given code"
|
||||||
"loadconfig:Loads and persists the given configuration"
|
"format:Formats the given files/patterns"
|
||||||
"local:Lists tasks installed locally via archives"
|
"help:Prints help information for tasks, aliases, modules, and applications"
|
||||||
"local.rebar:Installs Rebar locally"
|
"loadconfig:Loads and persists the given configuration"
|
||||||
"new:Creates a new Elixir project"
|
"local:Lists tasks installed locally via archives"
|
||||||
"profile.cprof:Profiles the given file or expression with cprof"
|
"local.rebar:Installs Rebar locally"
|
||||||
"profile.eprof:Profiles the given file or expression with eprof"
|
"new:Creates a new Elixir project"
|
||||||
"profile.fprof:Profiles the given file or expression with fprof"
|
"profile.cprof:Profiles the given file or expression with cprof"
|
||||||
"profile.tprof:Profiles the given file or expression with tprof"
|
"profile.eprof:Profiles the given file or expression with eprof"
|
||||||
"release:Assembles a self-contained release"
|
"profile.fprof:Profiles the given file or expression with fprof"
|
||||||
"release.init:Generates sample files for releases"
|
"profile.tprof:Profiles the given file or expression with tprof"
|
||||||
"run:Runs the current application"
|
"release:Assembles a self-contained release"
|
||||||
"test:Runs a project's tests"
|
"release.init:Generates sample files for releases"
|
||||||
"test.coverage:Build report from exported test coverage"
|
"run:Runs the current application"
|
||||||
"xref:Prints cross reference information"
|
"test:Runs a project's tests"
|
||||||
)
|
"test.coverage:Build report from exported test coverage"
|
||||||
|
"xref:Prints cross reference information"
|
||||||
|
)
|
||||||
|
|
||||||
# hex is a package manager
|
# mix help | perl -wln -e 'm{^mix (hex\.\S+)\s+#\s+(.+)} and print qq("$1:$2")'
|
||||||
# mix help | perl -wln -e 'm{^mix (hex\.\S+)\s+#\s+(.+)} and print qq("$1:$2")'
|
local -a hex_tasks=(
|
||||||
local -a hex_tasks=(
|
"hex.audit:Shows retired Hex deps for the current project"
|
||||||
"hex.audit:Shows retired Hex deps for the current project"
|
"hex.build:Builds a new package version locally"
|
||||||
"hex.build:Builds a new package version locally"
|
"hex.config:Reads, updates or deletes local Hex config"
|
||||||
"hex.config:Reads, updates or deletes local Hex config"
|
"hex.docs:Fetches or opens documentation of a package"
|
||||||
"hex.docs:Fetches or opens documentation of a package"
|
"hex.info:Prints Hex information"
|
||||||
"hex.info:Prints Hex information"
|
"hex.organization:Manages Hex.pm organizations"
|
||||||
"hex.organization:Manages Hex.pm organizations"
|
"hex.outdated:Shows outdated Hex deps for the current project"
|
||||||
"hex.outdated:Shows outdated Hex deps for the current project"
|
"hex.owner:Manages Hex package ownership"
|
||||||
"hex.owner:Manages Hex package ownership"
|
"hex.package:Fetches or diffs packages"
|
||||||
"hex.package:Fetches or diffs packages"
|
"hex.publish:Publishes a new package version"
|
||||||
"hex.publish:Publishes a new package version"
|
"hex.registry:Manages local Hex registries"
|
||||||
"hex.registry:Manages local Hex registries"
|
"hex.repo:Manages Hex repositories"
|
||||||
"hex.repo:Manages Hex repositories"
|
"hex.retire:Retires a package version"
|
||||||
"hex.retire:Retires a package version"
|
"hex.search:Open and perform searches"
|
||||||
"hex.search:Open and perform searches"
|
"hex.sponsor:Show Hex packages accepting sponsorships"
|
||||||
"hex.sponsor:Show Hex packages accepting sponsorships"
|
"hex.user:Manages your Hex user account"
|
||||||
"hex.user:Manages your Hex user account"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
# mix help | perl -wln -e 'm{^mix (phx\.\S+)\s+#\s+(.+)} and print qq("$1:$2")'
|
mix_tasks=($builtin_tasks[@] $hex_tasks[@])
|
||||||
local -a phoenix_tasks=(
|
fi
|
||||||
"phx.digest:Digests and compresses static files"
|
|
||||||
"phx.digest.clean:Removes old versions of static assets."
|
|
||||||
"phx.gen:Lists all available Phoenix generators"
|
|
||||||
"phx.gen.auth:Generates authentication logic for a resource"
|
|
||||||
"phx.gen.cert:Generates a self-signed certificate for HTTPS testing"
|
|
||||||
"phx.gen.channel:Generates a Phoenix channel"
|
|
||||||
"phx.gen.context:Generates a context with functions around an Ecto schema"
|
|
||||||
"phx.gen.embedded:Generates an embedded Ecto schema file"
|
|
||||||
"phx.gen.html:Generates context and controller for an HTML resource"
|
|
||||||
"phx.gen.json:Generates context and controller for a JSON resource"
|
|
||||||
"phx.gen.live:Generates LiveView, templates, and context for a resource"
|
|
||||||
"phx.gen.notifier:Generates a notifier that delivers emails by default"
|
|
||||||
"phx.gen.presence:Generates a Presence tracker"
|
|
||||||
"phx.gen.release:Generates release files and optional Dockerfile for release-based deployments"
|
|
||||||
"phx.gen.schema:Generates an Ecto schema and migration file"
|
|
||||||
"phx.gen.secret:Generates a secret"
|
|
||||||
"phx.gen.socket:Generates a Phoenix socket handler"
|
|
||||||
"phx.new:Creates a new Phoenix v1.8.5 application"
|
|
||||||
"phx.new.ecto:Creates a new Ecto project within an umbrella project"
|
|
||||||
"phx.new.web:Creates a new Phoenix web project within an umbrella project"
|
|
||||||
"phx.routes:Prints all routes"
|
|
||||||
"phx.server:Starts applications and their servers"
|
|
||||||
)
|
|
||||||
|
|
||||||
local -a tasks=(
|
_describe -t tasks 'task' mix_tasks
|
||||||
$mix_tasks[@]
|
|
||||||
$hex_tasks[@]
|
|
||||||
$phoenix_tasks[@]
|
|
||||||
)
|
|
||||||
|
|
||||||
_describe -t tasks 'task' tasks
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_mix_profile_tasks() {
|
_mix_profile_tasks() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue