From 37f5ebaf04dc7e8f2fd2740a7daed5fd532825b3 Mon Sep 17 00:00:00 2001 From: Akira Maeda Date: Mon, 26 May 2014 15:18:09 +0900 Subject: [PATCH] add rubocop completion --- src/_rubocop | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/_rubocop diff --git a/src/_rubocop b/src/_rubocop new file mode 100644 index 0000000000..43d5422d2c --- /dev/null +++ b/src/_rubocop @@ -0,0 +1,52 @@ +#compdef rubocop +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for rubocop (https://github.com/bbatsov/rubocop) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Akira Maeda +# +# ------------------------------------------------------------------------------ +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------ + +local curcontext="$curcontext" state line ret=1 +typeset -A opt_args + +_rubocop_format_params() { + _values \ + 'FORMAT' \ + 'progress' \ + 'simple' \ + 'clang' \ + 'json' \ + 'files' \ + 'offences' +} + +_arguments -C \ + '(--only)--only[Run just one cop.]' \ + '(-c --config)'{-c,--config}'[Specify configuration file]' \ + '(--auto-gen-config)--auto-gen-config[Generate a configuration file acting as a TODO list]' \ + '(-f --format)'{-f,--format}'[Choose an output formatter.]:FORMAT:_rubocop_format_params' \ + '(-o --out)'{-o,--out}'[Write output to a file instead of STDOUT]' \ + '(-r --require)'{-r,--require}'[Require Ruby file.]' \ + '(--show-cops)--show-cops[Shows the given cops, or all cops by default]' \ + '(-d --debug)'{-d,--debug}'[Display debug info]' \ + '(-D --display-cop-names)'{-D,--display-cop-names}'[Display cop names in offence messages.]' \ + '(-R --rails)'{-R,--rails}'[Run extra Rails cops.]' \ + '(-l --lint)'{-l,--lint}'[Run only lint cops.]' \ + '(-a --auto-correct)'{-a,--auto-correct}'[Auto-corrent offences.]' \ + '(-n --no-color)'{-n,--no-color}'[Disable color output.]' \ + '(-v --version)'{-v,--version}'[Disable version.]' \ + '(-V --verbose-version)'{-V,--verbose-version}'[Disable verbose version.]' \ + '(-h --help)'{-h,--help}'[Show help.]' \ + '*: :_files' && ret=0 + +return ret