Skip to content

Instantly share code, notes, and snippets.

@ppo
Created January 31, 2021 18:36
Show Gist options
  • Save ppo/b822097c69f618eb3fcd7de079c3e96d to your computer and use it in GitHub Desktop.
Save ppo/b822097c69f618eb3fcd7de079c3e96d to your computer and use it in GitHub Desktop.
copier --help | beautify 100cols
#!/usr/bin/env bash
echo -e "$(cat <<EOT
\e[1;33mWARNING!\e[0;33m
Use only trusted project templates, as they might execute
code with the same level of access as your user.\e[0m
Copier: Create or update a project from a template.
\e[1;37mUsage:\e[0m copier [\e[36mOPTION\e[0m]... [\e[32mCOMMAND\e[0m] [\e[34mARG\e[0m]...
\e[32mcopy\e[0m: copier [\e[36mOPTION\e[0m]... \e[32mcopy\e[0m \e[34mtemplate_src project_path\e[0m
\e[32mupdate\e[0m: copier [\e[36mOPTION\e[0m]... \e[32mupdate\e[0m [\e[34mproject_path\e[0m]
\e[1;37mCOMMANDS:\e[0m
\e[32mcopy\e[0m Create a project from a template.
\e[32mupdate\e[0m Update a project from its original template.
\e[1;37mARGS:\e[0m
\e[34mtemplate_src\e[0m The template to use. It can be a local path, an URL, or a shortcut URL. See remarks
below.
\e[34mproject_path\e[0m Path to the project to create/created from the template.
\e[1;37mOPTIONS:\e[0m
Template variables:
\e[36m-a, --answers-file\e[0m="VALUE" Path to the answers file to use (relative to \`\e[34mproject_path\e[0m\`).
Default: \`\e[34mproject_path\e[0m\`.
\e[36m-d, --data\e[0m="VARIABLE=VALUE" Make VARIABLE available as VALUE when rendering the template. May
be given multiple times.
Template options:
\e[36m-b, --subdirectory\e[0m="VALUE" Subdirectory to use when generating the project. Defaut: template
root.
\e[36m-p, --extra-paths\e[0m="VALUE" Additional directory to find parent templates in. May be given
multiple times.
\e[36m-x, --exclude\e[0m="VALUE" A name or shell-style pattern matching files or directories that
must not be copied. May be given multiple times.
Execution control:
\e[36m-f, --force\e[0m Overwrite files that already exist, without asking.
\e[36m-g, --prereleases\e[0m Use prereleases to compare template VCS tags.
\e[36m-n, --dry-run\e[0m Run but do not make any changes.
\e[36m-r, --vcs-ref\e[0m="VALUE" Git reference to checkout in \`\e[34mtemplate_src\e[0m\`. See remarks below.
\e[36m-s, --skip\e[0m Skip files that already exist, without asking.
Miscellaneous:
\e[36m-h, --help\e[0m Print this help message and quit.
\e[36m-q, --quiet\e[0m Suppress status output.
\e[36m-v, --version\e[0m Print the program's version and quit.
Only for \e[32mupdate\e[0m:
\e[36m-D, --no-diff\e[0m Disable smart diff detection.
\e[1;37mREMARKS:\e[0m
\e[32mupdate\e[0m:
The copy must have a valid answers file which contains info from the last Copier execution,
including the source template (specified with the key \`_src_path\`).
If the \`\e[34mproject_path\e[0m\` is a Git repository and the answer file defines a \`_commit\`, Copier will
do its best to respect the diff that you have generated since the last execution. To disable
that, use \`\e[36m--no-diff\e[0m\`.
\e[34mtemplate_src\e[0m:
Shortcut URLs are of the form \`platform:namespace/project\`.
Supported platforms are: \`gh\` for GitHub and \`gl\` for GitLab.
\e[36m-r, --vcs-ref\e[0m:
If you do not specify it, it will try to checkout the latest git tag, as sorted using the PEP
440 algorithm. If you want to checkout always the latest version, use \`--vcs-ref=HEAD\`.
EOT
)\n"
@ppo
Copy link
Author

ppo commented Feb 1, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment