Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: always ensure the base command is set to "sam" #1017

Merged
merged 3 commits into from
Feb 21, 2019

Conversation

sriram-mv
Copy link
Contributor

  • irrespective of the module name that invokes the CLI, the command that
    is seen on the help/description text, should always say "sam"

Example

(aws_sam_cli_WS) srirammv@localrainbow:20:20:34:~/aws_sam_cli_WS/aws-sam-cli$python -m samcli
Usage: sam [OPTIONS] COMMAND [ARGS]...

  AWS Serverless Application Model (SAM) CLI

  The AWS Serverless Application Model extends AWS CloudFormation to provide
  a simplified way of defining the Amazon API Gateway APIs, AWS Lambda
  functions, and Amazon DynamoDB tables needed by your serverless
  application. You can find more in-depth guide about the SAM specification
  here: https://github.com/awslabs/serverless-application-model.

Options:
  --debug    Turn on debug logging to print debug message generated by SAM
             CLI.
  --version  Show the version and exit.
  --info
  --help     Show this message and exit.

Commands:
  publish   Publish a packaged AWS SAM template to the AWS Serverless
            Application Repository.
  package   Package an AWS SAM application. This is an alias for 'aws
            cloudformation package'.
  init      Initialize a serverless application with a...
  build     Build your Lambda function code
  validate  Validate an AWS SAM template.
  local     Run your Serverless application locally for...
  logs      Fetch logs for a function
  deploy    Deploy an AWS SAM application. This is an alias for 'aws
            cloudformation deploy'.

we now see sam [OPTIONS] COMMAND [ARGS]... instead of __main__.py [OPTIONS] COMMAND [ARGS]...
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

- irrespective of the module name that invokes the CLI, the command that
  is seen on the help/description text, should always say "sam"
@sriram-mv sriram-mv requested a review from sanathkr February 20, 2019 04:22
@sriram-mv sriram-mv self-assigned this Feb 20, 2019

# NOTE(TheSriram): info_name is always set to "sam". This way when the CLI is invoked as a module,
# the help text that is generated still says "sam" instead of "__main__".
def make_context(self, info_name, args, parent=None, **extra):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pallets/click#82 is a better way to do it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is super clean. Nice find!

@sriram-mv
Copy link
Contributor Author

restarting build, due to transient failure.

@sriram-mv sriram-mv merged commit e8f1c44 into aws:develop Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants