aws-amplify / aws-amplify/amplify-cli

extend CLI command handling/registry to include help documentation, export for external consumption

Open
#11,628 0 comments 0 reactions 0 assignees View on GitHub
feature-request p4 platform
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Is this feature request related to a new or existing Amplify category?

_No response_

### Is this related to another service?

_No response_

### Describe the feature you'd like to request

Extend command handling/registry to house documentation for "help" functionality, and export for external consumption (suggestion is as follows)

```tsx
import * as cli from '@aws-amplify/cli-internal'

// get the JSON structure of command help
// approach is similar to `Response.json()` https://developer.mozilla.org/en-US/docs/Web/API/Response/json
const commands = await cli.commands.json()

// sample React page to generate FF docs
export function CommandsPage() {
return (

{commands.map(command => (

( /* registration ID? */ }

{command.name}


{ /* ... */ }

))}

)
}
```

This will remove the need for maintaining this documentation separately, and enables us to automate regenerating the documentation on CLI release.

Suggested structure of command JSON

```jsonc
{
"name": "help",
"description": "print help",
"aliases": ["h"],
"flags": [
{
"name": "verbose", // --verbose
"description": "print verbose help",
"aliases": ["v"], // -v
"type": "boolean"
}
],
"arguments": [
{
"name": "command",
"description": "command to print help for",
"type": "string"
}
],
"subcommands": [
{
// same command structure as above, enables multiple levels of subcommands
}
],
"links": [
{
"name": "Learn More",
"href": "https://docs.amplify.aws" // link that will print in the CLI
}
]
}
```

### Describe the solution you'd like

see above

### Describe alternatives you've considered

n/a

### Additional context

_No response_

### Is this something that you'd be interested in working on?

- [ ] 👋 I may be able to implement this feature request

### Would this feature include a breaking change?

- [ ] ⚠️ This feature might incur a breaking change

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.