Skip to content

tlmatjuda/toob-commons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TOOB - ( Go Lang ) Commons

This Go module is a collection of various operations.
The idea is to have a centralized module that has all the commons operations you may need when working on a Go project ( CLI tool, Web Application ... )

This includes operations for :

  • File IO operations.
  • Command Line Runner
  • Maven
  • Text / String

TECH STACK

The technology stack used in the project is :

  • Golang 1.22.x
  • You can use any IDE of your choice.


SETTING UP

You have a choice of checking this repo out and using the Go Workspaces feature.
Or you can pull this module directly into your projects using :

go get github.com/tlmatjuda/toob-commons


USAGE / EXAPMLES

CLI

When you are inside your Go module and you need to execute a native commands on the respective Windows or Unix based OS.
The bool is for when you want to capture the command output into a string when set to true otherwise it will log out to console as normal.

// Defintion
cli.Exec(command string, commandArgs []string, targetPath string, returnOutput bool) string {}

// Example
cli.Exec("mvn", "clean install", "/project/folder/with/pom.xml", false)

File IO

The File IO Operations include :

// Defintion
// Exists
// Checks if a given file Exists on the file system
fileio.Exists(path string) (bool, error) {}


// Example
fileio.Exists("/path/of/the/file.txt")

Text

The Text / String Operations include :

// StringBlank
// Strempty checks whether string contains only whitespace or not
text.StringBlank(s string) bool {}


// Example
text.StringBlank("Thabo Matjuda")

// OR

text.StringBlank(" ")

CONCLUSION

That's all. These are the operations I found important when building a few CLI tools with Go lang.
I will be adding more as we go.




About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages