Skip to content

Commit

Permalink
Add HELP_TEXT for init command (#1492)
Browse files Browse the repository at this point in the history
* Add HELP_TEXT for init command

* Reformat with Black
  • Loading branch information
awood45 authored Oct 30, 2019
1 parent 66b6542 commit e30ce9f
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions samcli/commands/init/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,51 @@

LOG = logging.getLogger(__name__)

HELP_TEXT = """ \b
Initialize a serverless application with a SAM template, folder
structure for your Lambda functions, connected to an event source such as APIs,
S3 Buckets or DynamoDB Tables. This application includes everything you need to
get started with serverless and eventually grow into a production scale application.
\b
This command can initialize a boilerplate serverless app. If you want to create your own
template as well as use a custom location please take a look at our official documentation.
\b
Common usage:
\b
Starts an interactive prompt process to initialize a new project:
\b
$ sam init
\b
Initializes a new SAM project using project templates without an interactive workflow:
\b
$ sam init --name sam-app --runtime nodejs10.x --dependency-manager npm --app-template hello-world
\b
Initializes a new SAM project using custom template in a Git/Mercurial repository
\b
# gh being expanded to github url
$ sam init --location gh:aws-samples/cookiecutter-aws-sam-python
\b
$ sam init --location git+ssh://git@github.com/aws-samples/cookiecutter-aws-sam-python.git
\b
$ sam init --location hg+ssh://hg@bitbucket.org/repo/template-name
\b
Initializes a new SAM project using custom template in a Zipfile
\b
$ sam init --location /path/to/template.zip
\b
$ sam init --location https://example.com/path/to/template.zip
\b
Initializes a new SAM project using custom template in a local path
\b
$ sam init --location /path/to/template/folder
"""


@click.command(
"init", short_help="Init an AWS SAM application.", context_settings=dict(help_option_names=["-h", "--help"])
"init",
help=HELP_TEXT,
short_help="Init an AWS SAM application.",
context_settings=dict(help_option_names=["-h", "--help"]),
)
@click.option(
"--no-interactive",
Expand Down Expand Up @@ -77,7 +119,7 @@ def do_cli(
You must not provide both the --location and --app-template parameters.
You can run 'sam init' without any options for an interactive initialization flow, or you can provide one of the following required parameter combinations:
--name and --runtime and --app-template
--name and --runtime and --app-template and --dependency-manager
--location
"""
raise UserException(msg)
Expand Down

0 comments on commit e30ce9f

Please sign in to comment.