mangalar

package module
v0.0.0-...-519dadb Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 5 Imported by: 0

README

mangalar

A comfortable way of running many programs in a terminal. It aims to replace bash scripts.

GoDoc

Example

package main

import (
	"github.com/bankole7782/mangalar"
	"fmt"
)

var toExec = `
tar -zcvf f8_files.tar.gz \
 $fn
tar -cJf f8_files.tar.xz $fn
tar -cJf f8_files2.tar.xz $fn
`

func main() {
	mo, err := mangalar.InitMObject(toExec)
	if err != nil {
		panic(err)
	}

	err = mo.RunAll(map[string]string{"fn": "f8_files"})
	if err != nil {
		panic(fmt.Sprintf("%+v", err))
	}
}

Notes
  1. You create a multiline string containing all the programs you want to run seperated by newlines.

  2. You pass the string in 1 to mangalar.InitMObject .

  3. You can then run all of the them even with the feature of simple variable substitution.

Documentation

Overview

A comfortable way of running many programs in a terminal

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MObject

type MObject struct {
	ProgramLines []string
}

func InitMObject

func InitMObject(stmt string) (MObject, error)

func (*MObject) RunAll

func (mo *MObject) RunAll(vars map[string]string) error

func (*MObject) RunOne

func (mo *MObject) RunOne(lineNo int, vars map[string]string) (string, error)

The line No is counted from 1 not 0 as in the programming language.

Jump to

Keyboard shortcuts

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