loom

package module
v0.0.0-...-16fa1dc Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2015 License: MIT Imports: 14 Imported by: 1

README

loom

A pure Go implementation of several SSH commands, inspired by Python's Fabric.

With loom, you can run commands as well as put and get files from remote servers, over SSH.

For documentation, check godoc.

For support, visit the Loom Email Group.

TODOs

  • Examples
  • In Run(), use pipes instead of CombinedOutput so that we can show the output of commands more interactively, instead of now, which is after they're completely done executing.
  • Handle wildcards in Get()
  • Better error checking in Get()

Documentation

Overview

Package loom implements a set of functions to interact with remote servers using SSH. It is based on the Python fabric library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The user name used in SSH connections. If not specified, the current user is assumed.
	User string

	// Password for SSH connections. This is optional. If the user has an ~/.ssh/id_rsa keyfile,
	// that will also be tried. In addition, other key files can be specified.
	Password string

	// The machine:port to connect to.
	Host string

	// The file names of additional key files to use for authentication (~/.ssh/id_rsa is defaulted).
	// RSA (PKCS#1), DSA (OpenSSL), and ECDSA private keys are supported.
	KeyFiles []string

	// If true, send command output to stdout.
	DisplayOutput bool

	// If true, errors are fatal and will abort immediately.
	AbortOnError bool
}

Config contains ssh and other configuration data needed for all the public functions in loom.

func (*Config) Get

func (config *Config) Get(remotefile string, localfile string) error

Get copies the file from the remote host to the local host, using scp. Wildcards are not currently supported.

func (*Config) Local

func (config *Config) Local(cmd string) (string, error)

Local executes a command on the local host.

func (*Config) Put

func (config *Config) Put(localfiles string, remotefile string) error

Put copies one or more local files to the remote host, using scp. localfiles can contain wildcards, and remotefile can be either a directory or a file.

func (*Config) PutString

func (config *Config) PutString(data string, remotefile string) error

PutString generates a new file on the remote host containing data. The file is created with mode 0644.

func (*Config) Run

func (config *Config) Run(cmd string) (string, error)

Run takes a command and runs it on the remote host, using ssh.

func (*Config) Sudo

func (config *Config) Sudo(cmd string) (string, error)

Sudo takes a command and runs it as root on the remote host, using sudo over ssh.

Jump to

Keyboard shortcuts

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