docs: improve CLI examples and make flags optional

Amolith and Crush created

Co-authored-by: Crush <crush@charm.land>

Change summary

main.go | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)

Detailed changes

main.go 🔗

@@ -24,6 +24,24 @@ var rootCmd = &cobra.Command{
 	Long: `formatted-commit helps you create well-formatted Git commits that follow
 the Conventional Commits specification with proper subject length validation,
 body wrapping, and trailer formatting.`,
+	Example: `
+# With co-author
+formatted-commit -t feat -m "do a thing" -T "Crush <crush@charm.land>"
+
+# Breaking change with longer body
+formatted-commit -t feat -m "do a thing that borks a thing" -B "$(cat <<'EOF'
+Multi-line
+- Body
+- Here
+
+This is what borked because of new shiny, this is how migrate
+EOF
+)"
+
+# Including scope for more precise changes
+formatted-commit -t refactor -s "web/git-bug" -m "fancy shmancy" \
+  -b "Had to do a weird thing because..."
+`,
 	RunE: func(cmd *cobra.Command, args []string) error {
 		// TODO: Implement commit formatting logic here
 		// 1. Validate subject length (type(scope): message <= 50 chars)
@@ -38,15 +56,13 @@ body wrapping, and trailer formatting.`,
 func init() {
 	rootCmd.Flags().StringVarP(&commitType, "type", "t", "", "commit type (required)")
 	rootCmd.Flags().StringVarP(&message, "message", "m", "", "commit message (required)")
-	rootCmd.Flags().StringSliceVarP(&trailers, "trailer", "T", []string{}, "trailer in 'Key: value' format (required, repeatable)")
-	rootCmd.Flags().StringVarP(&body, "body", "b", "", "commit body (required)")
+	rootCmd.Flags().StringSliceVarP(&trailers, "trailer", "T", []string{}, "trailer in 'Sentence-case-key: value' format (optional, repeatable)")
+	rootCmd.Flags().StringVarP(&body, "body", "b", "", "commit body (optional)")
 	rootCmd.Flags().StringVarP(&scope, "scope", "s", "", "commit scope (optional)")
 	rootCmd.Flags().BoolVarP(&breakingChange, "breaking", "B", false, "mark as breaking change (optional)")
 
 	rootCmd.MarkFlagRequired("type")
 	rootCmd.MarkFlagRequired("message")
-	rootCmd.MarkFlagRequired("trailer")
-	rootCmd.MarkFlagRequired("body")
 }
 
 func main() {