amber-lang / amber-lang/amber-docs

[Feature] Declarative CLI definitions with automatic help and documentation generation

未关闭
#210 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
13
派生
18
平均合并
11 小时 1 分钟
30 天内合并 PR
4

描述

This idea was originally discussed as part of #30, but it is a separate feature proposal, so it has been split out.

Provide a built-in or standard-library approach for defining command-line interfaces declaratively, allowing Amber programs to automatically generate:

* `-h` / `--help` output
* usage information
* argument validation
* Markdown documentation
* Unix man pages

## Motivation

Many command-line applications implement the same patterns repeatedly:

* short and long options (`-h`, `--help`, `-o`, `--output`)
* positional arguments
* default values
* required vs. optional arguments
* usage/help text

A declarative API or language feature could reduce boilerplate while making CLI interfaces more consistent across Amber projects.

## Inspiration

Python's `argparse` demonstrates how defining a CLI once can be used to generate help output automatically. Other CLI frameworks in different languages follow a similar "single source of truth" approach.

Amber could build on this idea by allowing the same CLI definition to generate:

* terminal help (`-h` / `--help`)
* Markdown documentation
* Unix man pages

This would keep documentation synchronized with the implementation and reduce duplicated effort.

## Possible approaches

This could be implemented as either:

* a standard/external Amber package, or
* dedicated language syntax, if there are compelling reasons to support it natively.

A library-first approach could help determine whether new language syntax is actually necessary.

## Benefits

* Less boilerplate
* Consistent CLI interfaces
* Automatic help generation
* Easier documentation maintenance
* Automatic man page generation
* Better developer experience for command-line applications

Related: #30

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。