utils

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package utils provides some small utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply added in v0.11.0

func Apply(repo, patch string, out io.Writer) error

Apply will apply the specified patch to the provided repository.

func Clone

func Clone(repo, path, commit string, ignoredSubmodules []string, out io.Writer) error

Clone will check out the provided repository set it to the specified version and properly checkout all submodules.

func Download

func Download(destination, source string) error

Download will download the specified source to the specified destination.

func Exists

func Exists(path string) (bool, error)

Exists will check if the provided file or directory exists.

func Fetch

func Fetch(path, commit string, ignoredSubmodules []string, out io.Writer) error

Fetch will update the remote repository and update all submodules accordingly.

func FindPort added in v0.8.2

func FindPort(out io.Writer) string

FindPort will return the fist known USB serial port or an empty string.

func Link(path, target string) error

Link will ensure a link with the specified target at the provided path.

func Log

func Log(out io.Writer, msg string)

Log will format and write the provided message to out if available.

func Original added in v0.10.0

func Original(path, name string) (string, error)

Original will return the original, unmodified contents of the specified file.

func Resolve added in v0.8.4

func Resolve(path, base string) (string, error)

Resolve will resolve a path and us the provided base for relative paths.

func Sync added in v0.8.3

func Sync(src, dst string) error

Sync will synchronize the two files. It will only copy if the destination is absent or differs.

func Update added in v0.10.1

func Update(path, content string) error

Update will write a file if the contents have changed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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