_nanoc 2.56 KB
Newer Older
Josh Parnham's avatar
Josh Parnham committed
1
2
3
4
5
6
7
#compdef nanoc
#autoload

# requires the 'nanoc' gem to be installed

local -a _1st_arguments
_1st_arguments=(
8
  'check:run issue checks'
Josh Parnham's avatar
Josh Parnham committed
9
10
11
12
13
  'compile:compile items of this site'
  'create-site:create a site'
  'deploy:deploy the compiled site'
  'help:show help'
  'prune:remove files not managed by nanoc from the output directory'
14
  'shell:open a shell on the Nanoc environment'
Josh Parnham's avatar
Josh Parnham committed
15
16
17
18
19
20
21
22
23
24
25
26
  'show-data:show data in this site'
  'show-plugins:show all available plugins'
  'show-rules:describe the rules for each item'
  'view:start the web server that serves static files'
)

local expl
local -a pkgs installed_pkgs

_arguments \
  '(--color)--color[enable color]' \
  '(--debug)--debug[enable debugging]' \
27
  '(--env)--env[set environment]' \
Josh Parnham's avatar
Josh Parnham committed
28
29
  '(--help)--help[show the help message and quit]' \
  '(--no-color)--no-color[disable color]' \
30
  '(--verbose)--verbose[make output more detailed]' \
Josh Parnham's avatar
Josh Parnham committed
31
32
33
34
  '(--version)--version[show version information and quit]' \
  '(--warn)--warn[enable warnings]' \
  '*:: :->subcmds' && return 0

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
case "$state" in
  subcmds)
    case $words[1] in
      check)
        _arguments \
          '(--preprocess)--preprocess[run preprocessor]'
      ;;

      compile)
        _arguments \
          '(--diff)--diff[generate diff]'
      ;;

      compile)
        _arguments \
          '(--diff)--diff[generate diff]'
      ;;

      create-site)
        _arguments \
          '(--force)--force[force creation of new site]'
      ;;

      deploy)
        _arguments \
          '(--target)--target[specify the location to deploy to (default: `default`)]' \
          '(--no-check)--no-check[do not run the issue checks marked for deployment]' \
          '(--list)--list[list available locations to deploy to]' \
          '(--list-deployers)--list-deployers[list available deployers]' \
          '(--dry-run)--dry-run[show what would be deployed]'
      ;;

      prune)
        _arguments \
          '(--yes)--yes[confirm deletion]' \
          '(--dry-run)--dry-run[print files to be deleted instead of actually deleting them]'
      ;;

      shell)
        _arguments \
          '(--preprocess)--preprocess[run preprocessor]'
      ;;

      view)
        _arguments \
          '(--handler)--handler[specify the handler to use (webrick/mongrel/...)]' \
          '(--host)--host[specify the host to listen on (default: 127.0.0.1)]' \
          '(--port)--port[specify the port to listen on (default: 3000]' \
          '(--live-reload)--live-reload[reload on changes]'
      ;;
    esac
  ;;
esac

Josh Parnham's avatar
Josh Parnham committed
89
90
91
92
if (( CURRENT == 1 )); then
  _describe -t commands "nanoc subcommand" _1st_arguments
  return
fi