tools

package
v0.0.0-...-bcd90ce Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2017 License: GPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MessageBox

func MessageBox(title, text string) int

func TellCommandNotToSpawnShell

func TellCommandNotToSpawnShell(_ *exec.Cmd)

Types

type Tools

type Tools struct {
	Directory   string
	IndexURL    string
	LastRefresh time.Time
	Logger      log.StdLogger
	// contains filtered or unexported fields
}

Tools handle the tools necessary for an upload on a board. It provides a means to download a tool from the arduino servers.

- *Directory* contains the location where the tools are downloaded. - *IndexURL* contains the url where the tools description is contained. - *Logger* is a StdLogger used for reporting debug and info messages - *installed* contains a map of the tools and their exact location

Usage: You have to instantiate the struct by passing it the required parameters:

_tools := tools.Tools{
    Directory: "/home/user/.arduino-create",
    IndexURL: "http://downloads.arduino.cc/packages/package_index.json"
    Logger: log.Logger
}

func (*Tools) Download

func (t *Tools) Download(pack, name, version, behaviour string) error

Download will parse the index at the indexURL for the tool to download. It will extract it in a folder in .arduino-create, and it will update the Installed map.

pack contains the packager of the tool name contains the name of the tool. version contains the version of the tool. behaviour contains the strategy to use when there is already a tool installed

If version is "latest" it will always download the latest version (regardless of the value of behaviour)

If version is not "latest" and behaviour is "replace", it will download the version again. If instead behaviour is "keep" it will not download the version if it already exists.

func (*Tools) DownloadPackageIndex

func (t *Tools) DownloadPackageIndex(index_file, signature_file string) error

func (*Tools) GetLocation

func (t *Tools) GetLocation(command string) (string, error)

GetLocation extracts the toolname from a command like

func (*Tools) Init

func (t *Tools) Init(APIlevel string)

Init creates the Installed map and populates it from a file in .arduino-create

Jump to

Keyboard shortcuts

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