friendly

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2022 License: GPL-3.0 Imports: 15 Imported by: 4

README

Friendly Go

License Go Version Lines Release Stars Contributors

A small library with functions I use all the time in my projects.

Also useful if you are starting to learn Go and are annoyed by implementing basic things in your project all the time.

Install and Use

In your project directory, type

go get github.com/alexcoder04/friendly

And then, in your code

package ...

import (
    ...
    "github.com/alexcoder04/friendly"
)

...
if friendly.IsDir(path) {
    friendly.CompressFolder(path, destination)
}
...

Functions

github.com/alexcoder04/friendly
// files
func WriteNewFile(file string, content string) error { }
func WriteLines(file string, lines []string) error { }
func ReadLines(file string) ([]string, error) { }
func CopyFile(source string, destin string) error { }
func CopyFolder(source string, destination string) error { }
func GetConfigDir(program string) (string, error) { } // creates the directory if it doesn't exist
func GetLogDir(program string) (string, error) { } // creates the directory if it doesn't exist

// io
func Input(prompt string) (string, error) { }

// os
func Getpwd() string { }
func Run(command string, arguments []string, workingDir string) error { }
func GetOutput(command string, arguments []string, workingDir string) (string, error) { }
func Exists(path string) bool { }
func IsFile(path string) bool { }
func IsDir(path string) bool { }
func ListFilesRecursively(folder string) ([]string, error) { }

// zip
func UncompressFolder(source string, destination string) error { }
func CompressFolder(folder string, destination string) error { }

// misc
func ArrayContains[T comparable](arr []T, value T) bool { }
func IsInt(num string) bool { }
func SemVersionGreater(v1 string, v2 string) bool { }
func DownloadFile(downloadUrl string, path string) error { }
github.com/alexcoder04/friendly/linux
// desktop
func GetDisplayServer() string { }
func GuiRunning() bool { }

Contributing

If you use this library and are missing some feature - don't hesiatate to open a pull request or an issue, I'm always looking forward to improve this project!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayContains

func ArrayContains[T comparable](arr []T, value T) bool

func CompressFolder

func CompressFolder(folder string, destination string) error

func CopyFile

func CopyFile(source string, destin string) error

func CopyFolder

func CopyFolder(source string, destination string) error

func DownloadFile

func DownloadFile(downloadUrl string, path string) error

func Exists added in v0.4.0

func Exists(path string) bool

func GetConfigDir added in v0.2.0

func GetConfigDir(program string) (string, error)

func GetLogDir added in v0.2.0

func GetLogDir(program string) (string, error)

func GetOutput added in v0.4.0

func GetOutput(command string, arguments []string, workingDir string) (string, error)

func Getpwd added in v0.3.1

func Getpwd() string

func Input added in v1.0.0

func Input(prompt string) (string, error)

func IsDir

func IsDir(path string) bool

func IsFile

func IsFile(path string) bool

func IsInt added in v1.0.0

func IsInt(num string) bool

func ListFilesRecursively added in v0.2.1

func ListFilesRecursively(folder string) ([]string, error)

func ReadLines

func ReadLines(file string) ([]string, error)

func Run added in v0.3.0

func Run(command string, arguments []string, workingDir string) error

func SemVersionGreater

func SemVersionGreater(v1 string, v2 string) bool

func UncompressFolder

func UncompressFolder(source string, destination string) error

func WriteLines

func WriteLines(file string, lines []string) error

func WriteNewFile added in v0.4.0

func WriteNewFile(file string, content string) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL