535fafde816b0c45521c5de2003ae9e0038cc424

Author
Mirko Caserta <mirko.caserta@gmail.com>
Committer
Mirko Caserta <mirko.caserta@gmail.com>
Date

Message

SBT and Scala plugins.

The SBT (Simple Build Tool: scala-sbt.org) plugin is an original
work of mine.
The Scala (scala-lang.org) plugin was taken from zsh-lovers.

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/sbt/_sbt b/plugins/sbt/_sbt
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..91372aa721ed2f807d0073077648c45378d01a75
  4--- /dev/null
  5+++ b/plugins/sbt/_sbt
  6@@ -0,0 +1,55 @@
  7+#compdef sbt
  8+#autoload
  9+
 10+local -a _sbt_commands
 11+_sbt_commands=(
 12+  'clean:delete files produced by the build'
 13+  'compile:compile sources'
 14+  'console:start the Scala REPL with project classes on the classpath'
 15+  'console-quick:start the Scala REPL with project deps on the classpath'
 16+  'console-project:start the Scala REPL w/sbt+build-def on the classpath'
 17+  'dist:generate distribution artifacts'
 18+  'dist\:clean:clean distribution artifacts'
 19+  'doc:generate API documentation'
 20+  'gen-idea:generate Intellij Idea project files'
 21+  'package:produce the main artifact, such as a binary jar'
 22+  'package-doc:produce a doc artifact, such as a jar containing API docs'
 23+  'package-src:produce a source artifact, such as a jar containing sources'
 24+  'publish:publish artifacts to a repository'
 25+  'publish-local:publish artifacts to the local repository'
 26+  'run:run a main class'
 27+  'run-main:run the main class selected by the first argument'
 28+  'test:execute all tests'
 29+  'test-only:execute the tests provided as arguments'
 30+  'test-quick:execute previously failed tests'
 31+  'update:resolve and optionally retrieve dependencies'
 32+)
 33+
 34+local expl
 35+
 36+_arguments \
 37+  '(-help)-h[prints an help message]' \
 38+  '(-h)-help[prints an help message]' \
 39+  '(-verbose)-v[this runner is chattier]' \
 40+  '(-v)-verbose[this runner is chattier]' \
 41+  '(-debug)-d[set sbt log level to debug]' \
 42+  '(-d)-debug[set sbt log level to debug]' \
 43+  '-no-colors[disable ANSI color codes]' \
 44+  '-sbt-create[start even if current dir contains no sbt project]' \
 45+  '-sbt-dir[path to global settings/plugins dir (default: ~/.sbt)]' \
 46+  '-sbt-boot[path to shared boot dir (default: ~/.sbt/boot)]' \
 47+  '-ivy[path to local Ivy repository (default: ~/.ivy2)]' \
 48+  '-mem[set memory options]' \
 49+  '-no-share[use all local caches; no sharing]' \
 50+  '-no-global[use global caches, but do not use global ~/.sbt dir]' \
 51+  '-jvm-debug[turn on JVM debugging, open at the given port]' \
 52+  '-batch[disable interactive mode]' \
 53+  '-sbt-version[use the specified version of sbt]' \
 54+  '-sbt-jar[use the specified jar as the sbt launcher]' \
 55+  '(-sbt-snapshot)-sbt-rc[use an RC version of sbt]' \
 56+  '(-sbt-rc)-sbt-snapshot[use a snapshot version of sbt]' \
 57+  '-java-home[alternate JAVA_HOME]' \
 58+  '*:: :->subcmds' && return 0
 59+
 60+_describe -t commands "sbt subcommand" _sbt_commands
 61+return
 62diff --git a/plugins/sbt/sbt.plugin.zsh b/plugins/sbt/sbt.plugin.zsh
 63new file mode 100644
 64index 0000000000000000000000000000000000000000..203c691f582cd14ee9a4e4a21c63d21b26e2310e
 65--- /dev/null
 66+++ b/plugins/sbt/sbt.plugin.zsh
 67@@ -0,0 +1,23 @@
 68+# ------------------------------------------------------------------------------
 69+#          FILE:  sbt.plugin.zsh
 70+#   DESCRIPTION:  oh-my-zsh plugin file.
 71+#        AUTHOR:  Mirko Caserta (mirko.caserta@gmail.com)
 72+#       VERSION:  1.0.2
 73+# ------------------------------------------------------------------------------
 74+ 
 75+# aliases - mnemonic: prefix is 'sb'
 76+alias sbc='sbt compile'
 77+alias sbco='sbt console'
 78+alias sbcq='sbt console-quick'
 79+alias sbcl='sbt clean'
 80+alias sbcp='sbt console-project'
 81+alias sbd='sbt doc'
 82+alias sbdc='sbt dist:clean'
 83+alias sbdi='sbt dist'
 84+alias sbgi='sbt gen-idea'
 85+alias sbp='sbt publish'
 86+alias sbpl='sbt publish-local'
 87+alias sbr='sbt run'
 88+alias sbrm='sbt run-main'
 89+alias sbu='sbt update'
 90+alias sbx='sbt test'
 91diff --git a/plugins/scala/_scala b/plugins/scala/_scala
 92new file mode 100644
 93index 0000000000000000000000000000000000000000..c4ccb37d35fec9fa60887d470187b018995e6091
 94--- /dev/null
 95+++ b/plugins/scala/_scala
 96@@ -0,0 +1,249 @@
 97+#compdef scala scalac
 98+# ------------------------------------------------------------------------------
 99+# Copyright (c) 2012 Github zsh-users - http://github.com/zsh-users
100+# All rights reserved.
101+#
102+# Redistribution and use in source and binary forms, with or without
103+# modification, are permitted provided that the following conditions are met:
104+#     * Redistributions of source code must retain the above copyright
105+#       notice, this list of conditions and the following disclaimer.
106+#     * Redistributions in binary form must reproduce the above copyright
107+#       notice, this list of conditions and the following disclaimer in the
108+#       documentation and/or other materials provided with the distribution.
109+#     * Neither the name of the zsh-users nor the
110+#       names of its contributors may be used to endorse or promote products
111+#       derived from this software without specific prior written permission.
112+#
113+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
114+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
115+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
116+# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
117+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
118+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
119+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
120+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
121+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
122+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
123+# ------------------------------------------------------------------------------
124+# Description
125+# -----------
126+#
127+#  Completion script for scala and scalac (http://www.scala-lang.org/).
128+#
129+# ------------------------------------------------------------------------------
130+# Authors
131+# -------
132+#
133+#  * Tony Sloane <inkytonik@gmail.com>
134+#
135+# ------------------------------------------------------------------------------
136+
137+typeset -A opt_args
138+local context state line
139+
140+_scala_features () {
141+   compadd "postfixOps" "reflectiveCalls" "implicitConversions" "higherKinds" \
142+     "existentials" "experimental.macros" "_"
143+}
144+
145+_scala_phases () {
146+   compadd "parser" "namer" "packageobjects" "typer" "patmat" "superaccessors" \
147+     "extmethods" "pickler" "refchecks" "selectiveanf" "selectivecps" "uncurry" \
148+     "tailcalls" "specialize" "explicitouter" "erasure" "posterasure" "lazyvals" \
149+     "lambdalift" "constructors" "flatten" "mixin" "cleanup" "icode" "inliner" \
150+     "inlineExceptionHandlers" "closelim" "dce" "jvm" "terminal"
151+}
152+
153+local -a shared_opts
154+shared_opts=(
155+  "-bootclasspath+[Override location of bootstrap class files]:bootstrap class directory:_files -/"
156+  "-classpath+[Specify where to find user class files]:directory:_files -/"
157+  "-D-[Pass -Dproperty=value directly to the runtime system]"
158+  "-d+[Destination for generated classfiles]: directory or jar file:_files"
159+  "-dependencyfile+[Set dependency tracking file]:dependency tracking file:_files"
160+  "-deprecation[Emit warning and location for usages of deprecated APIs]"
161+  "-encoding+[Specify character encoding used by source files]:encoding:"
162+  "-explaintypes[Explain type errors in more detail]"
163+  "-extdirs+[Override location of installed extensions]:extensions directory:_files -/"
164+  "-g\:-[Set level of generated debugging info (default\: vars)]:debugging info level:(none source line vars notailcalls)"
165+  "-help[Print a synopsis of standard options]"
166+  "-J-[pass argument directly to Java runtime system]:JVM argument:"
167+  "-javabootclasspath+[Override java boot classpath]:Java boot class path directory]:_files -/"
168+  "-javaextdirs+[Override java extdirs classpath]:Java extdirs directory:_files -/"
169+  "-language\:-[Enable one or more language features]:feature:_scala_features"
170+  "-no-specialization[Ignore @specialize annotations]"
171+  "-nobootcp[Do not use the boot classpath for the scala jars]"
172+  "-nowarn[Generate no warnings]"
173+  "-optimise[Generate faster bytecode by applying optimisations to the program]"
174+  "-P\:-[Pass an option to a plugin (written plugin\:opt)]:plugin option:"
175+  "-print[Print program with Scala-specific features removed]"
176+  "-sourcepath+[Specify location(s) of source files]:source file directory:_files -/"
177+  "-target\:-[Target platform for object files (default\: jvm-1.5)]:platform name:(jvm-1.5 msil)"
178+  "-toolcp+[Add to the runner classpath]:directory:_files -/"
179+  "-unchecked[Enable detailed unchecked (erasure) warnings]"
180+  "-uniqid[Uniquely tag all identifiers in debugging output]"
181+  "-usejavacp[Utilize the java.class.path in classpath resolution]"
182+  "-verbose[Output messages about what the compiler is doing]"
183+  "-version[Print product version and exit]"
184+  "-X[Print a synopsis of advanced options]"
185+  "-Y[Print a synopsis of private options]"
186+)
187+
188+local -a X_opts
189+X_opts=(
190+  "-Xcheck-null[Warn upon selection of nullable reference]"
191+  "-Xcheckinit[Wrap field accessors to throw an exception on uninitialized access]"
192+  "-Xdisable-assertions[Generate no assertions or assumptions]"
193+  "-Xelide-below+[Calls to @elidable methods are omitted if method priority is lower than integer argument]"
194+  "-Xexperimental[Enable experimental extensions]"
195+  "-Xfatal-warnings[Fail the compilation if there are any warnings]"