Skip to content

Fix format inconsistency in SAM CLI help text#8663

Open
vicheey wants to merge 12 commits intodevelopfrom
fix-command-help-text
Open

Fix format inconsistency in SAM CLI help text#8663
vicheey wants to merge 12 commits intodevelopfrom
fix-command-help-text

Conversation

@vicheey
Copy link
Contributor

@vicheey vicheey commented Feb 17, 2026

Which issue(s) does this change fix?

Fix format inconsistency issue across SAM CLI help text.

Why is this change necessary?

SAM CLI commands had inconsistent help text formatting with different section structures, spacing, and organization. Some commands used custom formatters while others used the base CoreCommand pattern. This inconsistency made the CLI harder to read and maintain.

How does it address the issue?

  • Migrated all commands to use the CoreCommand pattern with consistent section structure
  • Standardized option grouping across commands (e.g., "AWS Credential Options", "Configuration Options", "Other Options")
  • Implemented nested indented_section formatting for example section with descriptive titles
  • Used RowDefinition(text="\n") for consistent spacing before command in example sections
  • Removed 19 custom formatter files.
  • Added proper type hints (-> Dict, -> CommandHelpTextFormatter, -> None) to satisfy mypy
  • Created core command structures for pipeline init and bootstrap commands

What side effects does this change have?

  • Help text output format changes for all commands (improved consistency and readability)
  • Deleted 19 custom formatter files, reducing code duplication
  • All existing tests updated to match new format expectations
  • Added 2 new test files for pipeline commands

Mandatory Checklist

PRs will only be reviewed after checklist is complete

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@vicheey vicheey marked this pull request as ready for review February 17, 2026 16:55
@vicheey vicheey requested a review from a team as a code owner February 17, 2026 16:55
@github-actions github-actions bot added area/package sam package command area/deploy sam deploy command area/validate sam validate command area/init sam init area/logs sam logs command area/build sam build command area/local/invoke sam local invoke command area/pipeline area/delete area/sync sam sync command pr/internal labels Feb 17, 2026
@reedham-aws
Copy link
Contributor

Do you have an example of what some of the changed commands look like before and after?

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

samdev pipeline -h

Before

Screenshot 2026-02-17 at 12 53 02 PM

After

Screenshot 2026-02-17 at 12 51 59 PM

samdev pipeline init -h

Before

Screenshot 2026-02-17 at 12 54 09 PM

After

Screenshot 2026-02-17 at 12 54 30 PM

samdev pipeline bootstrap -h

Before

Screenshot 2026-02-17 at 12 55 13 PM

After

Screenshot 2026-02-17 at 12 55 42 PM

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

sam deploy -h

Before

Screenshot 2026-02-17 at 12 57 28 PM

After

Screenshot 2026-02-17 at 12 58 08 PM

sam build -h

Before

Screenshot 2026-02-17 at 12 59 31 PM

After

Screenshot 2026-02-17 at 12 59 57 PM

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

sam delete -h

Before

Screenshot 2026-02-17 at 1 10 15 PM

After

Screenshot 2026-02-17 at 1 10 21 PM

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

sam local -h

Before

Screenshot 2026-02-17 at 1 11 22 PM

After

Screenshot 2026-02-17 at 1 11 41 PM

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

sam remote -h

Before

Screenshot 2026-02-17 at 1 13 56 PM

After

Screenshot 2026-02-17 at 1 13 04 PM

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

sam remote invoke -h

Before

Screenshot 2026-02-17 at 1 15 07 PM

After

Screenshot 2026-02-17 at 1 14 46 PM

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

sam remote execution -h

Before

Screenshot 2026-02-17 at 1 16 49 PM

After

Screenshot 2026-02-17 at 1 16 56 PM

@roger-zhangg
Copy link
Member

do you have a chance to remove the new tag from the main command help as well?

sam --help

  Learn:
    docs NEW!           Launch the AWS SAM CLI documentation in a browser.

  Create an App:
    init                Initialize an AWS SAM application.

  Develop your App:
    build               Build your AWS serverless function code.
    local               Run your AWS serverless function locally.
    validate            Validate an AWS SAM template.
    sync NEW!           Sync an AWS SAM project to AWS.
    remote NEW!         Invoke or send an event to cloud resources in your AWS
                        Cloudformation stack.

  Deploy your App:
    package             Package an AWS SAM application.
    deploy              Deploy an AWS SAM application.

  Monitor your App:
    logs                Fetch AWS Cloudwatch logs for AWS Lambda Functions or
                        Cloudwatch Log groups.
    traces              Fetch AWS X-Ray traces.

  And More:
    list NEW!           Fetch the state of your AWS serverless application.

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

sam package -h

Before

Screenshot 2026-02-17 at 1 43 49 PM

After

Screenshot 2026-02-17 at 1 43 57 PM

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

sam -h

Before

Screenshot 2026-02-17 at 2 06 48 PM

After

Screenshot 2026-02-17 at 2 04 54 PM

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

sam publish -h

Before

Screenshot 2026-02-17 at 2 16 34 PM

After

Screenshot 2026-02-17 at 2 16 45 PM

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

sam traces -h

before

Screenshot 2026-02-17 at 2 22 04 PM

after

Screenshot 2026-02-17 at 2 22 12 PM

@vicheey
Copy link
Contributor Author

vicheey commented Feb 17, 2026

sam local start-api -h

before

Screenshot 2026-02-17 at 2 39 00 PM

after

Screenshot 2026-02-17 at 2 39 05 PM

@valerena
Copy link
Contributor

I personally don't like all the extra space that some of the SAM CLI help outputs had, and now it looks like now we're unifying all the commands to have that extra space. (for example sam local --help)
old

$ sam local --help
Usage: sam local [OPTIONS] COMMAND [ARGS]...

  Run your Serverless application locally for quick development & testing

Options:
  -h, --help  Show this message and exit.

Commands:
  callback        Send callbacks to durable function executions
  execution       Manage durable function executions
  generate-event  Generate events for Lambda functions.
  invoke          Invoke AWS serverless functions locally.
  start-api       Run & test AWS serverless functions locally as a HTTP API.
  start-lambda    Emulate AWS serverless functions locally.

vs new

$ sam local --help

Usage: sam local [OPTIONS] COMMAND [ARGS]...

  Run your Serverless application locally for quick development & testing

Options:

  -h, --help  Show this message and exit.

Commands:

  callback (NEW!)    Send callbacks to durable function executions

  execution (NEW!)   Manage durable function executions

  generate-event     Generate events for Lambda functions.

  invoke             Invoke AWS serverless functions locally.

  start-api          Run & test AWS serverless functions locally as a HTTP API.

  start-lambda       Emulate AWS serverless functions locally.

Do you know why we have all the extra space? Is that a conscious decision?

@valerena
Copy link
Contributor

Now in the code I see that it's not just "a format thing", but we explicitly add new lines everywhere. Do we like that?

@vicheey
Copy link
Contributor Author

vicheey commented Feb 25, 2026

Now in the code I see that it's not just "a format thing", but we explicitly add new lines everywhere. Do we like that?

Before the changes, some command had space between option description while some didn't. For consistency, either add space or remove all space. I chose to add because it provided clear separation especially for multiline description.

Do you prefer no line like the before in here: #8663 (comment)?

@vicheey
Copy link
Contributor Author

vicheey commented Feb 26, 2026

TODO: remove the new line between command option description.

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

Labels

area/build sam build command area/delete area/deploy sam deploy command area/init sam init area/local/invoke sam local invoke command area/logs sam logs command area/package sam package command area/pipeline area/sync sam sync command area/validate sam validate command pr/internal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants