From c35a6318b64af93beacf23134ead395a50ffcd3e Mon Sep 17 00:00:00 2001 From: farseer90718 Date: Wed, 7 Aug 2013 12:13:27 +0800 Subject: [PATCH] add jekyll completion --- src/_jekyll | 145 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 src/_jekyll diff --git a/src/_jekyll b/src/_jekyll new file mode 100644 index 0000000..37f3576 --- /dev/null +++ b/src/_jekyll @@ -0,0 +1,145 @@ +#compdef jekyll +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for jekyll(http://jekyllrb.com) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * farseer90718 (https://github.com/farseer90718) +# +# ------------------------------------------------------------------------------ + +local ret=1 state + +local -a common_ops +common_ops=( + {-v,--version}"[Display version information]" + {-h,--help}"[Display help documentation]" + {-p,--plugins}"[Plugins directory (defautls to ./_plugins)]: :_directories" + {-s,--source}"[Source directory (defaults to ./)]: :_directories" + {-d,--destination}"[Destination directory (defautls to ./_site)]: :_directories" + "--layouts=[Layouts directory (defaults to ./_layouts)]: :_directories" + "--safe=[Safe mode (defaults to false)]" +) + +typeset -A opt_args +_arguments \ + ':subcommand:->subcommand' \ + $common_ops \ + '*::options:->options' && ret=0 + +case $state in + subcommand) + local -a subcommands + subcommands=( + "build:Build your site" + "docs:Launch local server with docs for jekyll" + "doctor:Search site and print specific deprecation warnings" + "help:Dislplay global or [command] help documentation" + "import:Import your old blog to Jekyll" + "new:Creates a new Jekyll site scaffold in PATH" + "serve:Serve your stie locally" + ) + + _describe -t subcommands 'jekyll subcommand' subcommands && ret=0 + ;; + + options) + local -a args + args=( + $common_ops + ) + + local -a config + config=( + "--config[Custome configuration file]: :_files" + ) + local -a help + help=( + {-h,--help}"[Display help information]" + ) + local -a build + build=( + {-w,--watch}"[Watch for changes and rebuild]" + "--limit_posts[Limits the number of posts to parse and publish]" + "--future[Publishes posts with a future date]" + "--lsi[Use LSI for improved related posts]" + "--drafts[Render posts in the _drafts folder]" + ) + + case $words[1] in + help) + args=() + compadd "$@" build docs doctor help import new serve + ;; + + build) + args+=( + $build + $config + ) + ;; + + docs) + args=( + {-p,--port}"[Port to listen on]: :_ports" + {-u,--host}"[Host to bind to]: :_hosts" + $help + ) + ;; + + doctor) + args+=( + $config + ) + ;; + + import) + args=( + "--source[Source file or URL to migrate from]:url" + "--file[File to migrate from]: :_files" + "--dbname[Database name to migrate from]:database" + "--user[Username to use when migrating]:user" + "--pass[Password to use when migrating]:password" + "--host[Host address to use when migrating]:url" + $help + ) + ;; + + new) + args=( + ": :_directories" + "--force[Force creation even if PATH already exists]" + "--blank[Creates scaffolding but with empty files]" + $help + ) + ;; + + serve) + args+=( + $build + $config + {-P,--port}"[Port to listen on]: :_posts" + {-H,--host}"[Host to bind to]: :_hosts" + {-b,--baseurl}"[Base URL]:url" + ) + + esac + + _arguments $args && ret=0 + ;; +esac + +return ret + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et