nanoc: update to latest version (#7282)

* nanoc: update command aliases

- remove deprecated commands
- update `create-site`
- add `prune`

* nanoc: update README

* nanoc: update autompletion

- update commands
- add flag options to subcommands
This commit is contained in:
Josh Parnham 2018-10-18 06:26:48 +11:00 committed by Marc Cornellà
parent 2fce9a4d44
commit a2dab42c35
3 changed files with 68 additions and 26 deletions

View File

@ -10,14 +10,11 @@ plugins=(... nanoc)
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
|-------|-----------------------|----------------------------------------------------| |-------|-----------------------|-----------------------------------------------------------------------------------|
| n | `nanoc` | Main Nanoc command | | n | `nanoc` | Main Nanoc command |
| na | `nanoc autocompile` | The autocompile command has been deprecated since Nanoc 3.6. Use [guard-nanoc](https://github.com/nanoc/nanoc/tree/master/guard-nanoc) instead. | | nco | `nanoc compile` | Compile all items of the current site |
| nco | `nanoc compile` | Compile all items of the current site. | | ncs | `nanoc create-site` | Create a new site at the given path. The site will use the filesystem data source |
| nci | `nanoc create_item` | Command was deprecated in Nanoc v.3 and completely removed in v.4 | | nd | `nanoc deploy` | Deploy the compiled site to the destination (specified with `--target`) |
| ncl | `nanoc create_layout` | Command was deprecated in Nanoc v.3 and completely removed in v.4 | | np | `nanoc prune` | Remove files not managed by Nanoc from the output directory |
| ncs | `nanoc create_site` | Create a new site at the given path. The site will use the filesystem data source. | | nv | `nanoc view` | Start the static web server (on port 3000 and all IP addresses, unless specified) |
| nd | `nanoc deploy` | Deploys the compiled site. The compiled site contents in the output directory will be uploaded to the destination, which is specified using the --target option. |
| nv | `nanoc view` | Start the static web server. Unless specified, the web server will run on port 3000 and listen on all IP addresses. |
| nw | `nanoc watch` | The watch command has been deprecated since Nanoc 3.6. Use [guard-nanoc](https://github.com/nanoc/nanoc/tree/master/guard-nanoc) instead. |

View File

@ -1,28 +1,21 @@
#compdef nanoc #compdef nanoc
#autoload #autoload
# nanoc zsh completion - based on the homebrew zsh completion
# requires the 'nanoc' gem to be installed # requires the 'nanoc' gem to be installed
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'autocompile:start the autocompiler' 'check:run issue checks'
'compile:compile items of this site' 'compile:compile items of this site'
'create-item:create an item'
'create-layout:create a layout'
'create-site:create a site' 'create-site:create a site'
'deploy:deploy the compiled site' 'deploy:deploy the compiled site'
'help:show help' 'help:show help'
'prune:remove files not managed by nanoc from the output directory' 'prune:remove files not managed by nanoc from the output directory'
'shell:open a shell on the Nanoc environment'
'show-data:show data in this site' 'show-data:show data in this site'
'show-plugins:show all available plugins' 'show-plugins:show all available plugins'
'show-rules:describe the rules for each item' 'show-rules:describe the rules for each item'
'update:update the data stored by the data source to a newer version'
'validate-css:validate the sites CSS'
'validate-html:validate the sites HTML'
'validate-links:validate links in site'
'view:start the web server that serves static files' 'view:start the web server that serves static files'
'watch:start the watcher'
) )
local expl local expl
@ -31,13 +24,68 @@ local -a pkgs installed_pkgs
_arguments \ _arguments \
'(--color)--color[enable color]' \ '(--color)--color[enable color]' \
'(--debug)--debug[enable debugging]' \ '(--debug)--debug[enable debugging]' \
'(--env)--env[set environment]' \
'(--help)--help[show the help message and quit]' \ '(--help)--help[show the help message and quit]' \
'(--no-color)--no-color[disable color]' \ '(--no-color)--no-color[disable color]' \
'(--verbose)--verbose[make nanoc output more detailed]' \ '(--verbose)--verbose[make output more detailed]' \
'(--version)--version[show version information and quit]' \ '(--version)--version[show version information and quit]' \
'(--warn)--warn[enable warnings]' \ '(--warn)--warn[enable warnings]' \
'*:: :->subcmds' && return 0 '*:: :->subcmds' && return 0
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
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
_describe -t commands "nanoc subcommand" _1st_arguments _describe -t commands "nanoc subcommand" _1st_arguments
return return

View File

@ -1,9 +1,6 @@
alias n='nanoc' alias n='nanoc'
alias na='nanoc autocompile'
alias nco='nanoc compile' alias nco='nanoc compile'
alias nci='nanoc create_item' alias ncs='nanoc create-site'
alias ncl='nanoc create_layout'
alias ncs='nanoc create_site'
alias nd='nanoc deploy' alias nd='nanoc deploy'
alias np='nanoc prune'
alias nv='nanoc view' alias nv='nanoc view'
alias nw='nanoc watch'