Add generate_interactive (close #5)

This commit is contained in:
Chris de Graaf 2017-09-21 15:51:00 +01:00
parent b50c949431
commit d337c5f910
3 changed files with 35 additions and 4 deletions

View File

@ -18,6 +18,7 @@ interactive_template
```@docs ```@docs
generate generate
generate_interactive
``` ```
## Helper Functions ## Helper Functions

View File

@ -6,8 +6,9 @@ using Mustache
using TerminalMenus using TerminalMenus
using URIParser using URIParser
export generate, interactive_template, show_license, available_licenses, Template, export generate, interactive_template, generate_interactive, show_license,
GitHubPages, AppVeyor, TravisCI, GitLabCI, CodeCov, Coveralls available_licenses, Template, GitHubPages, AppVeyor, TravisCI, GitLabCI, CodeCov,
Coveralls
abstract type Plugin end abstract type Plugin end

View File

@ -6,7 +6,7 @@
ssh::Bool=false, ssh::Bool=false,
) -> Void ) -> Void
Generate a package names `pkg_name` from `template`. Generate a package named `pkg_name` from `template`.
# Keyword Arguments # Keyword Arguments
* `force::Bool=false`: Whether or not to overwrite old packages with the same name. * `force::Bool=false`: Whether or not to overwrite old packages with the same name.
@ -78,7 +78,7 @@ function generate(
# Generate the files. # Generate the files.
files = vcat( files = vcat(
gen_entrypoint(dir, pkg_name, t), gen_entrypoint(dir, pkg_name, t),
gen_tests(dir, pkg_name, t), gen_tests(dir, pkg_name, t),
gen_require(dir, pkg_name, t), gen_require(dir, pkg_name, t),
gen_readme(dir, pkg_name, t), gen_readme(dir, pkg_name, t),
@ -114,6 +114,35 @@ function generate(
end end
end end
"""
generate_interactive(
pkg_name::AbstractString;
force::Bool=false,
ssh::Bool=false,
backup_dir::AbstractString="",
fast::Bool=false,
) -> Void
Interactively create a template, and then generate a package with it. Arguments and
keywords are used in the same way as in [`generate`](@ref) and
[`interactive_template`](@ref).
"""
function generate_interactive(
pkg_name::AbstractString;
force::Bool=false,
ssh::Bool=false,
backup_dir::AbstractString="",
fast::Bool=false,
)
generate(
pkg_name,
interactive_template(; fast=fast);
force=force,
ssh=ssh,
backup_dir=backup_dir,
)
end
""" """
gen_entrypoint( gen_entrypoint(
dir::AbstractString, dir::AbstractString,