mirror of
https://github.com/veggiemonk/awesome-docker.git
synced 2026-05-16 12:57:40 +02:00
feat(cli): add fix-order command for sorting README entries
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,7 @@ func main() {
|
|||||||
root.AddCommand(
|
root.AddCommand(
|
||||||
versionCmd(),
|
versionCmd(),
|
||||||
lintCmd(),
|
lintCmd(),
|
||||||
|
fixOrderCmd(),
|
||||||
checkCmd(),
|
checkCmd(),
|
||||||
healthCmd(),
|
healthCmd(),
|
||||||
buildCmd(),
|
buildCmd(),
|
||||||
@@ -314,6 +315,25 @@ func buildHealthReportIssueBody(report string, healthErr error) string {
|
|||||||
return b.String()
|
return b.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func fixOrderCmd() *cobra.Command {
|
||||||
|
return &cobra.Command{
|
||||||
|
Use: "fix-order",
|
||||||
|
Short: "Sort README entries alphabetically within each section",
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
count, err := linter.SortFile(readmePath)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("fix-order: %w", err)
|
||||||
|
}
|
||||||
|
if count == 0 {
|
||||||
|
fmt.Println("Already sorted, no changes needed")
|
||||||
|
} else {
|
||||||
|
fmt.Printf("Sorted %d lines in %s\n", count, readmePath)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func lintCmd() *cobra.Command {
|
func lintCmd() *cobra.Command {
|
||||||
var fix bool
|
var fix bool
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
|||||||
Reference in New Issue
Block a user