use clap::Subcommand;
use crate::model::RfcPhase;
use crate::{
CommonDeprecateArgs, CommonEditArgs, CommonGetArgs, CommonListArgs, CommonRenderArgs,
CommonShowArgs, CommonSupersedeArgs, FinalizeStatus,
};
#[derive(Subcommand, Clone, Debug)]
pub(crate) enum RfcCommand {
#[command(after_help = "\
FILTERS:
Filter may be an RFC status, phase, or ID/title substring.
EXAMPLES:
govctl rfc list
govctl rfc list draft
govctl rfc list impl -n 5
govctl rfc list RFC-0002 -o json
")]
List(CommonListArgs),
#[command(after_help = "\
VALID FIELDS:
- title, version, status, phase, owners, refs, changelog
EXAMPLES:
govctl rfc get RFC-0001
govctl rfc get RFC-0001 title
govctl rfc get RFC-0001 refs
")]
Get(CommonGetArgs),
#[command(after_help = "\
EXAMPLES:
govctl rfc show RFC-0001
govctl rfc show RFC-0001 --history
govctl rfc show RFC-0001 -o plain
govctl rfc show RFC-0001 -o yaml
NOTES:
- Human-readable `show` hides deprecated RFC bodies and obsolete Clause bodies by default.
- Use `--history` for complete archival human-readable content.
- JSON, YAML, and TOML output stays complete and cannot be combined with `--history`.
- Use `get` for field/path-level inspection.
")]
Show(CommonShowArgs),
#[command(after_help = "\
EXAMPLES:
govctl rfc new \"Add incremental index rebuilding\"
govctl rfc new \"Add incremental index rebuilding\" --id RFC-0010
NOTES:
- Use `--id` only when you need to pin a specific RFC ID.
- New RFCs start as draft and can later be finalized.
")]
New {
title: String,
#[arg(long)]
id: Option<String>,
},
#[command(after_help = "\
EXAMPLES:
govctl rfc edit RFC-0001 changelog.summary --set \"Clarify retry behavior\"
govctl rfc edit RFC-0001 changelog.fixed --add \"Correct timeout wording\"
govctl rfc edit RFC-0001 changelog.fixed[0] --remove
govctl rfc edit RFC-0001 refs --add RFC-0002
NOTES:
- Changelog edits apply only to the entry matching the RFC's current version.
- RFC and changelog version/date fields are lifecycle-owned.
")]
Edit(CommonEditArgs),
#[command(after_help = "\
EXAMPLES:
govctl rfc bump RFC-0001 --patch -m \"Clarify examples\"
govctl rfc bump RFC-0001 --minor -m \"Add a normative clause\" -c \"change: Define the new behavior\"
govctl rfc bump RFC-0001 -c \"fix: Correct current-version wording\"
NOTES:
- Version-changing bumps require a normative RFC in impl, test, or stable with a sealed signature.
- While an RFC is in spec, continue authoring the current version candidate instead of bumping again.
- Bump flags select literal SemVer components; they are not remapped impact labels.
- For 0.y.z, use `--minor` for a breaking pre-1.0 amendment; `--major` deliberately advances to 1.0.0.
- `--change` without a bump level updates the current changelog entry without changing version.
- Use `-m/--summary` for a release summary and `-c/--change` for detailed entries.
")]
Bump {
id: String,
#[arg(long, group = "bump_level")]
patch: bool,
#[arg(long, group = "bump_level")]
minor: bool,
#[arg(long, group = "bump_level")]
major: bool,
#[arg(short = 'm', long)]
summary: Option<String>,
#[arg(short = 'c', long = "change")]
changes: Vec<String>,
},
#[command(after_help = "\
EXAMPLES:
govctl rfc finalize RFC-0001 normative
NOTES:
- Use `deprecate` for normative → deprecated.
- Use `advance` to move phase after finalization.
")]
Finalize {
id: String,
#[arg(value_enum)]
status: FinalizeStatus,
},
#[command(after_help = "\
EXAMPLES:
govctl rfc advance RFC-0001 impl
govctl rfc advance RFC-0001 test
NOTES:
- Typical progression is `spec -> impl -> test -> stable`.
- Use this after the RFC has been finalized.
")]
Advance {
id: String,
#[arg(value_enum)]
phase: RfcPhase,
},
#[command(after_help = "\
EXAMPLES:
govctl rfc deprecate RFC-0001
govctl rfc deprecate RFC-0001 --force
")]
Deprecate(CommonDeprecateArgs),
#[command(after_help = "\
EXAMPLES:
govctl rfc supersede RFC-0001 --by RFC-0002
govctl rfc supersede RFC-0001 --by RFC-0002 --force
")]
Supersede(CommonSupersedeArgs),
#[command(after_help = "\
EXAMPLES:
govctl rfc render RFC-0001
govctl rfc render RFC-0001 --dry-run
")]
Render(CommonRenderArgs),
}