Skip to content

Releases: canonical/gencodo

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 02 Sep 14:59

Closes #15, #16, #17, #18, #19, #20.

Added

  • Functional options on GenDocs, GenMarkdownTree, and GenRSTTree: WithExampleParser, WithFuncs, WithDryRun, WithHiddenFlags, WithoutHelpFlag (#17)
  • ValidateTemplates renders both templates against synthetic data without writing files, for use in unit tests and CI (#18)
  • Built-in template helpers slug, anchor, titleCase, trimPrefix, trimSuffix, trimSpace, lower, upper, join, replace; all helpers are now available in the index template too (#16)
  • ExampleParser.BlockSeparator and ExampleParser.DisableIndentDetection; CRLF line endings are normalised and a leading tab counts as indentation (#19)
  • Exported CommandData, IndexData, and CommandSummary types describing the template data
  • FlagInfo gained Shorthand, Type, NoOptDefVal, Deprecated, ShorthandDeprecated, Hidden, Required, SetByCobra
  • Command template data gained File, InheritedFlags, Subcommands, Parent, Aliases, Deprecated, Runnable, Annotations; index template data gained Root and Commands
  • README: template data reference, helper functions, link formatting patterns, behaviour notes, development and release process (#15)
  • make lint (golangci-lint v2, config in .golangci.yaml), make reuse, coverage summary in make test-coverage; CI lint, coverage, and REUSE jobs; Dependabot for Go modules and Actions (#20)
  • Release workflow publishing a GitHub release from the CHANGELOG section on every vX.Y.Z tag; make release refuses to tag without that section
  • REUSE compliance: LICENSES/LGPL-3.0-only.txt, REUSE.toml, SPDX headers on all files

Changed

  • Hidden flags (including flags hidden by pflag's MarkDeprecated) are omitted by default, matching Cobra's help and doc output; use WithHiddenFlags() to include them
  • Minimum Go version is 1.23; dependencies bumped to cobra 1.10.2 and pflag 1.0.10
  • Output files are rendered in memory and written only on success, so a template error no longer leaves partial files; file close errors are reported
  • The command template is parsed once per tree instead of once per command, and template parse errors are reported before any file or directory is created
  • HeadingLen counts characters rather than bytes
  • A nil file prepender is accepted
  • The generator function types changed (trailing ...Option); calls are source-compatible, but code that assigned a generator to a variable of the old function type must be updated

Fixed

  • GoDoc claimed the command prefix is stripped from ExampleInfo.Usage; it is kept verbatim, as it always was
  • GoDoc claimed MinIndent: 0 disables indentation detection; it selects the default of 2 (use DisableIndentDetection)
  • GoDoc and README claimed .Files is sorted alphabetically; it follows Cobra's command order
  • README listed a non-existent headingLen helper and misdescribed replaceSpaces

v0.2.1

Choose a tag to compare

@akcano akcano released this 02 Sep 14:58
aa15189

Changed

  • CI hardening only: SAST workflows (gosec, govulncheck), zizmor workflow lint, pinned action versions, persist-credentials: false; maintainer release process documented in README. No library changes.

v0.2.0

Choose a tag to compare

@akcano akcano released this 02 Sep 14:58
43f06a9

Added

  • Panic recovery around template execution to turn panics into errors
  • Concurrent usage test coverage and make test-race target
  • Comprehensive GoDoc for exported types (FlagInfo, ExampleInfo, ExampleParser, TemplateInfo)

Changed

  • BREAKING: Removed the unused linkHandler parameter from GenDocs, GenMarkdownTree, and GenRSTTree; link formatting now lives entirely in templates

Migration:

// before
gencodo.GenRSTTree(rootCmd, dir, templates, filePrepender, linkHandler)
// after
gencodo.GenRSTTree(rootCmd, dir, templates, filePrepender)