Skip to content

Commit

Permalink
feat: adicionar documentação detalhada para pacotes e funções no projeto
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianoflorentino committed Dec 15, 2024
1 parent 2f8ffe2 commit a8c8515
Show file tree
Hide file tree
Showing 12 changed files with 235 additions and 72 deletions.
20 changes: 19 additions & 1 deletion internal/ponteiros/topics.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Package ponteiros provides functions and utilities to understand and work with pointers in Go.
// It includes sections on what pointers are, when to use them, and provides a menu and help options
// for navigating through the different topics related to pointers.
package ponteiros

import (
Expand All @@ -6,22 +9,34 @@ import (
"github.com/fabianoflorentino/aprendago/pkg/format"
)

const rootDir = "internal/ponteiros"
// rootDir represents the relative path to the directory where the pointer-related topics are stored within the project.
const (
rootDir = "internal/ponteiros"
)

// Ponteiros prints the chapter title and executes sections related to pointers.
// It covers topics such as what pointers are and when to use them.
func Ponteiros() {
fmt.Printf("\n\nCapítulo 14: Ponteiros\n")

executeSection("O que são ponteiros?")
executeSection("Quando usar ponteiros")
}

// MenuPonteiros returns a slice of MenuOptions for the "ponteiros" topic.
// Each MenuOption contains an option string and an associated execution function.
// The options provided are:
// --o-que-sao-ponteiros: Executes the section explaining what pointers are.
// --quando-usar-ponteiros: Executes the section explaining when to use pointers.
func MenuPonteiros([]string) []format.MenuOptions {
return []format.MenuOptions{
{Options: "--o-que-sao-ponteiros", ExecFunc: func() { executeSection("O que são ponteiros?") }},
{Options: "--quando-usar-ponteiros", ExecFunc: func() { executeSection("Quando usar ponteiros") }},
}
}

// HelpMePonteiros prints a help message for the "Ponteiros" (Pointers) chapter.
// It provides descriptions of what pointers are in Go and when to use them.
func HelpMePonteiros() {
hlp := []format.HelpMe{
{Flag: "--o-que-sao-ponteiros", Description: "Descreve o que são ponteiros em Go", Width: 0},
Expand All @@ -32,6 +47,9 @@ func HelpMePonteiros() {
format.PrintHelpMe(hlp)
}

// executeSection formats and processes a specific section of the documentation.
// It takes a section name as a string parameter and uses the FormatSection function
// from the format package to apply the formatting to the section located in the rootDir.
func executeSection(section string) {
format.FormatSection(rootDir, section)
}
28 changes: 27 additions & 1 deletion internal/seu_ambiente_de_desenvolvimento/topics.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Package seu_ambiente_de_desenvolvimento provides functionalities to display and manage
// information related to the development environment setup. It includes sections on
// terminal usage, Go workspace and environment variables, IDEs, Go commands, GitHub
// repositories, cross-compilation, and packages. The package offers functions to display
// these sections, generate menu options, and provide help descriptions for each section.
package seu_ambiente_de_desenvolvimento

import (
Expand All @@ -6,8 +11,15 @@ import (
"github.com/fabianoflorentino/aprendago/pkg/format"
)

var rootDir = "internal/seu_ambiente_de_desenvolvimento"
// rootDir represents the root directory path for the development environment configuration files.
const (
rootDir = "internal/seu_ambiente_de_desenvolvimento"
)

// SeuAmbienteDeDesenvolvimento prints the title of Chapter 19 and executes a series of sections
// related to setting up and understanding your development environment in Go. The sections include
// topics such as using the terminal, Go workspace and environment variables, IDEs, Go commands,
// GitHub repositories, exploring GitHub, cross-compilation, and packages.
func SeuAmbienteDeDesenvolvimento() {
fmt.Print("\n\nCapítulo 19: Seu Ambiente de Desenvolvimento\n")

Expand All @@ -21,6 +33,12 @@ func SeuAmbienteDeDesenvolvimento() {
executeSection("Pacotes")
}

// MenuSeuAmbienteDeDesenvolvimento returns a slice of format.MenuOptions,
// each representing a different development environment topic with an associated
// execution function. The options include topics such as terminal usage, Go workspace
// and environment variables, IDEs, Go commands, GitHub repositories, exploring GitHub,
// cross-compilation, and packages. Each option is linked to a function that executes
// the corresponding section.
func MenuSeuAmbienteDeDesenvolvimento([]string) []format.MenuOptions {
return []format.MenuOptions{
{Options: "--o-terminal", ExecFunc: func() { executeSection("O terminal") }},
Expand All @@ -34,6 +52,10 @@ func MenuSeuAmbienteDeDesenvolvimento([]string) []format.MenuOptions {
}
}

// HelpMeSeuAmbienteDeDesenvolvimento provides a list of help topics related to the development environment.
// It includes information about the terminal, Go workspace environment variables, IDEs, Go commands,
// GitHub repositories, exploring GitHub, cross-compilation, and packages.
// The function prints the chapter title and then displays the help topics using the format.PrintHelpMe function.
func HelpMeSeuAmbienteDeDesenvolvimento() {
hlp := []format.HelpMe{
{Flag: "--o-terminal", Description: "Exibe informações sobre o terminal."},
Expand All @@ -50,6 +72,10 @@ func HelpMeSeuAmbienteDeDesenvolvimento() {
format.PrintHelpMe(hlp)
}

// executeSection formats and processes a given section of the project.
// It takes a section name as a string parameter and uses the FormatSection
// function from the format package to format the specified section within
// the root directory.
func executeSection(section string) {
format.FormatSection(rootDir, section)
}
25 changes: 23 additions & 2 deletions internal/structs/topics.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Package structs provides functions to demonstrate and execute various sections
// related to structs in Go. It includes functions to print topics, generate menu
// options, and display help information for different struct-related sections.
package structs

import (
Expand All @@ -6,17 +9,29 @@ import (
"github.com/fabianoflorentino/aprendago/pkg/format"
)

const rootDir = "internal/structs"
// rootDir represents the relative path to the directory where internal structures are stored.
const (
rootDir = "internal/structs"
)

// TopicStructs prints the chapter title for structs and executes sections related to structs.
// It covers the following sections:
// - Structs
// - Embedded Structs
// - Reading Documentation
// - Anonymous Structs
func TopicStructs() {
fmt.Print("\n\n10 - Structs\n")
fmt.Print("\n\nCapítulo 10 - Structs\n")

executeSection("Structs")
executeSection("Structs embutidos")
executeSection("Lendo a documentação")
executeSection("Structs anônimos")
}

// MenuStructs returns a slice of MenuOptions, each representing a menu item
// related to different topics about structs in Go. Each menu item has an option
// string and an associated function to execute when the option is selected.
func MenuStructs([]string) []format.MenuOptions {
return []format.MenuOptions{
{Options: "--structs", ExecFunc: func() { executeSection("Structs") }},
Expand All @@ -26,6 +41,9 @@ func MenuStructs([]string) []format.MenuOptions {
}
}

// HelpMeStructs prints a help message for various struct-related topics.
// It defines a slice of HelpMe structs with flags and descriptions for each topic,
// and then prints the chapter title followed by the formatted help message.
func HelpMeStructs() {
hlp := []format.HelpMe{
{Flag: "--structs", Description: "Structs", Width: 0},
Expand All @@ -38,6 +56,9 @@ func HelpMeStructs() {
format.PrintHelpMe(hlp)
}

// executeSection formats and processes a given section of the project.
// It takes a section name as a string and uses the FormatSection function
// from the format package to format the section within the root directory.
func executeSection(section string) {
format.FormatSection(rootDir, section)
}
32 changes: 29 additions & 3 deletions internal/variaveis_valores_tipos/topics.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Package variaveis_valores_tipos provides functions and constants to demonstrate
// various concepts related to variables, values, and types in Go programming language.
// It includes sections on Go Playground, Hello World, short declaration operator,
// reserved word var, exploring types, zero value, fmt package, creating custom types,
// and type conversion (not coercion).
package variaveis_valores_tipos

import (
Expand All @@ -6,10 +11,23 @@ import (
"github.com/fabianoflorentino/aprendago/pkg/format"
)

const rootDir = "internal/variaveis_valores_tipos"
const (
rootDir = "internal/variaveis_valores_tipos"
)

// VariaveisValoresETipos demonstrates various concepts related to variables, values, and types in Go.
// It prints section titles and executes corresponding sections to illustrate:
// - Go Playground
// - Hello, World!
// - Short variable declaration operator
// - The var keyword
// - Exploring types
// - Zero value
// - The fmt package
// - Creating your own type
// - Conversion, not coercion
func VariaveisValoresETipos() {
fmt.Printf("\n\n02 - Variáveis, Valores & Tipos\n")
fmt.Printf("\n\nCapítulo 02 - Variáveis, Valores & Tipos\n")

executeSection("Go Playground")
executeSection("Hello, World!")
Expand All @@ -22,6 +40,9 @@ func VariaveisValoresETipos() {
executeSection("Conversão, não coerção")
}

// MenuVariaveisValoresTipos returns a slice of MenuOptions, each representing a different
// section of the "Variáveis, Valores e Tipos" topic. Each MenuOption contains an option
// string and an ExecFunc function that executes the corresponding section when called.
func MenuVariaveisValoresTipos([]string) []format.MenuOptions {
return []format.MenuOptions{
{Options: "--go-playground", ExecFunc: func() { executeSection("Go Playground") }},
Expand All @@ -36,8 +57,10 @@ func MenuVariaveisValoresTipos([]string) []format.MenuOptions {
}
}

// HelpMeVariaveisValoresTipos prints a list of help topics related to variables, values, and types in Go.
// Each topic includes a flag and a description in Portuguese.
// The function displays the chapter title and then prints the help topics using the format.PrintHelpMe function.
func HelpMeVariaveisValoresTipos() {

hlp := []format.HelpMe{
{Flag: "--go-playground", Description: "Exibe o Go Playground.", Width: 0},
{Flag: "--hello-world", Description: "Exibe o Hello World.", Width: 0},
Expand All @@ -54,6 +77,9 @@ func HelpMeVariaveisValoresTipos() {
format.PrintHelpMe(hlp)
}

// executeSection formats and processes a given section of the project.
// It takes a section name as a string and uses the FormatSection function
// from the format package to format the section within the root directory.
func executeSection(section string) {
format.FormatSection(rootDir, section)
}
27 changes: 26 additions & 1 deletion internal/visao_geral_do_curso/topics.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Package visao_geral_do_curso provides an overview of the course "Aprenda Go".
// It includes functions to display different sections of the course,
// generate a menu with options to navigate through the sections,
// and provide help descriptions for each section.
package visao_geral_do_curso

import (
Expand All @@ -6,8 +10,14 @@ import (
"github.com/fabianoflorentino/aprendago/pkg/format"
)

const rootDir = "internal/visao_geral_do_curso"
// rootDir represents the root directory path for the "visao_geral_do_curso" module within the project.
const (
rootDir = "internal/visao_geral_do_curso"
)

// VisaoGeralDoCurso prints an overview of the course topics to the console.
// It sequentially executes sections that welcome the user, explain why Go is beneficial,
// outline success strategies, provide resources, and describe how the course works.
func VisaoGeralDoCurso() {
fmt.Printf("\n01 - Visão Geral do Curso\n")

Expand All @@ -18,6 +28,14 @@ func VisaoGeralDoCurso() {
executeSection("Como esse curso funciona")
}

// MenuVisaoGeralDoCurso returns a slice of MenuOptions for the course overview menu.
// Each MenuOption contains an option string and an associated function to execute when the option is selected.
// The options include:
// --bem-vindo: Executes the "Bem-vindo!" section.
// --porque-go: Executes the "Por que Go?" section.
// --sucesso: Executes the "Sucesso" section.
// --recursos: Executes the "Recursos" section.
// --como-esse-curso-funciona: Executes the "Como esse curso funciona" section.
func MenuVisaoGeralDoCurso([]string) []format.MenuOptions {
return []format.MenuOptions{
{Options: "--bem-vindo", ExecFunc: func() { executeSection("Bem-vindo!") }},
Expand All @@ -28,6 +46,9 @@ func MenuVisaoGeralDoCurso([]string) []format.MenuOptions {
}
}

// HelpMeVisaoGeralDoCurso provides a list of help topics related to the overview of the "Aprenda Go" course.
// It includes flags and descriptions for various aspects such as welcome message, benefits of learning Go,
// tips for success, available resources, and course structure.
func HelpMeVisaoGeralDoCurso() {
hlp := []format.HelpMe{
{Flag: "--bem-vindo", Description: "Exibe a mensagem de boas-vindas ao curso Aprenda Go.", Width: 0},
Expand All @@ -41,6 +62,10 @@ func HelpMeVisaoGeralDoCurso() {
format.PrintHelpMe(hlp)
}

// executeSection formats and processes a given section of the course.
// It takes the section name as a string parameter and uses the FormatSection
// function from the format package to apply the formatting to the section
// located in the root directory.
func executeSection(section string) {
format.FormatSection(rootDir, section)
}
Loading

0 comments on commit a8c8515

Please sign in to comment.