ohmygosh

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 1 Imported by: 0

README

Oh My Gosh! 😱

Install

go get -u github.com/Frank-Mayer/ohmygosh

Usage

package main

import (
	"fmt"
	"os"

	"github.com/Frank-Mayer/ohmygosh"
)

func main() {
	if err := ohmygosh.Execute(`echo "hello $(whoami)" | cat`); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}

Features

  • Execute basic shell commands (built-in)
    • cd
    • exit
    • echo
    • cat
    • export
    • unset
    • whoami
    • pwd
    • which
    • sudo
      • unix
      • windows
    • yes
    • true
    • false
    • sleep
    • seq
    • parallel
    • type
  • Execute programs from PATH or with explicit path
  • Execute shell scripts
  • Shell functions
  • Shell aliases
  • command1 | command2 (pipe)
  • command1 & command2 (parallel)
  • command1 && command2 (if success)
  • command1 || command2 (if failure)
  • command1 ; command2 (sequential)
  • command1 > file (redirect stdout)
  • command1 < file (redirect stdin)
  • command1 2> file (redirect stderr)
  • command1 2>&1 (redirect stderr to stdout)
  • command1 1>&2 (redirect stdout to stderr)
  • command1 &> file (redirect stdout and stderr)
  • command1 |& command2 (pipe stdout and stderr)
  • command1 <<< "input" (here string)
  • command1 << EOF (here document)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(text string) error

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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