From 568d0db1811e11caa8a1e925de2e691d8bf2641e Mon Sep 17 00:00:00 2001 From: Fabiano Santos Florentino Date: Sun, 22 Dec 2024 11:35:29 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20adicionar=20documenta=C3=A7=C3=A3o=20e?= =?UTF-8?q?=20fun=C3=A7=C3=B5es=20auxiliares=20para=20o=20pacote=20documen?= =?UTF-8?q?tacao?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/documentacao/topics.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/internal/documentacao/topics.go b/internal/documentacao/topics.go index 69605ee..6e3b937 100644 --- a/internal/documentacao/topics.go +++ b/internal/documentacao/topics.go @@ -1,3 +1,7 @@ +// Package documentacao provides functionalities to handle documentation topics +// for the "aprendago" project. It includes functions to display documentation +// sections, generate menu options for documentation topics, and print help +// information related to documentation. package documentacao import ( @@ -6,10 +10,14 @@ import ( "github.com/fabianoflorentino/aprendago/pkg/format" ) +// rootDir represents the root directory for documentation files within the project. const ( rootDir = "internal/documentacao" ) +// Package documentacao provides functions to execute and display various sections +// related to Go documentation. It includes topics such as introduction to documentation, +// usage of go doc, godoc, and pkg.go.dev, as well as writing documentation. func Documentacao() { fmt.Printf("\n\nCapítulo 25: Documentação\n") @@ -20,6 +28,12 @@ func Documentacao() { executeSections("Escrevendo documentação") } +// Package documentacao provides functionalities related to documentation topics in Go. +// It includes a menu with various documentation options and their respective execution functions. + +// MenuDocumentacao returns a slice of MenuOptions containing different documentation topics +// and their associated execution functions. Each option is represented by a string and +// an ExecFunc that executes the corresponding section. func MenuDocumentacao([]string) []format.MenuOptions { return []format.MenuOptions{ {Options: "--introducao", ExecFunc: func() { executeSections("Introdução") }}, @@ -30,6 +44,18 @@ func MenuDocumentacao([]string) []format.MenuOptions { } } +// HelpMeDocumentacao provides a list of documentation topics and their descriptions. +// It prints a formatted help message for Chapter 25: Documentation. +// +// The topics include: +// - Introdução: Introduction to the topic +// - go doc: Information about the 'go doc' command +// - godoc: Information about the 'godoc' command +// - https://pkg.go.dev/: Link to the Go package documentation website +// - Escrevendo documentação: Tips on writing documentation +// +// This function is part of the 'documentacao' package, which contains utilities and helpers +// for generating and managing documentation in Go projects. func HelpMeDocumentacao() { hlp := []format.HelpMe{ {Flag: "--introducao", Description: "Introdução"}, @@ -43,6 +69,9 @@ func HelpMeDocumentacao() { format.PrintHelpMe(hlp) } +// executeSections formats and processes a given section of documentation. +// It takes a section name as a string and uses the FormatSection function +// from the format package to apply formatting to the section within the root directory. func executeSections(section string) { format.FormatSection(rootDir, section) }