Skip to content

Commit

Permalink
feat: adicionar documentação e funções auxiliares para o pacote docum…
Browse files Browse the repository at this point in the history
…entacao
  • Loading branch information
fabianoflorentino committed Dec 22, 2024
1 parent 0264417 commit 568d0db
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions internal/documentacao/topics.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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")

Expand All @@ -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") }},
Expand All @@ -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"},
Expand All @@ -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)
}

0 comments on commit 568d0db

Please sign in to comment.