Giter Site home page Giter Site logo

go-basher's Introduction

Hello, I'm Jeff! ๐Ÿ‘‹

I'm a creator and entrepreneur known for my work and ideas in open source developer tooling.

I try to push the boundaries of computing as a magical tool and compiler for the imagination.

Since you found me on GitHub, you can join my Discord.

go-basher's People

Contributors

alexquick avatar codelingobot avatar coderofsalvation avatar josegonzalez avatar kron4eg avatar lalyos avatar mathieu-aubin avatar michaelshobbs avatar progrium avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-basher's Issues

Should honor $PATH for detection of bash binary

On my system, /bin/bash is version 3 and /usr/local/bin/bash is version 4 (which would be common in Mac systems using Homebrew). My $PATH is setup to correctly put /usr/loca/bin before /bin. g-basher should honor $PATH precedence to avoid the following error:

$ gun
/var/folders/1h/xkn96jrj3d71f_s06j8cnmqc0000gn/T/bashenv.271918130: line 75: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/var/folders/1h/xkn96jrj3d71f_s06j8cnmqc0000gn/T/bashenv.271918130: line 103: :help: syntax error: operand expected (error token is ":help")
/var/folders/1h/xkn96jrj3d71f_s06j8cnmqc0000gn/T/bashenv.271918130: main: command not found

go command startup footprint

Is this a bash-compatible bash-replacement written in GO, or does this wrap a bash script?

What is the startup footprint of a go-command invoked on the commandline?
Does each go-command already somehow run in memory like a bash-builtin?

REASON: I've been tinkering with an (unreleased) similar version of this (but focused on nodejs).
However, big disappointment was nodejs's startup footprint when executing each command on the commandline.

So far C builtins is the only thing i could use without getting a speed penalty.

Export Variables

How can you export a variable from the .Go to the bash script
example something like
bash.HandleVar("variablename", variablename)
then in the main.bash you can do echo $variablename

is something like that possible?

Linux 32-bit support

Hi,

I am getting this error while trying to run a binary built on a 32-bit OS

2017/11/01 15:31:26 exec: not started

Thera re no errors form go-bindata nor go build but execution of the binary fails.

Regards
Matias

Cannot execute the binary on RHEL

I am getting below error while running this on RHEL box. The binary is working fine on Mac and Ubuntu machines.

/tmp/bashenv.235468405: line 35: syntax error near unexpected token `('

/tmp/bashenv.235468405: line 35: export BASH_FUNC_module()=$'() { eval /usr/bin/modulecmd bash $*`'

Any idea whats wrong here?

Go + bash syntax

Hi,

What about making bash + go syntax?

#!basher

export VAR=1

import "fmt"

func print_something (foo string) {
    fmt.Println(foo, $VAR);
}

print_something Mars
print_something Jupiter

An example on how to use the basher.Application() function?

I understand that this can be used in situations where we are not exactly sure if /bin/bash is available in the system or not.

But I'm not able to figure out how to use this function.

It would be great if someone can give an example!

How do I run a specific script as sudo ?

I loaded 3 scripts and embedded them using go-bindata.

In that 2 scripts needs to be run with admin privileges and 1 script should be run as user.

How can I run a specific script as sudo?

In the example code there is only a concept of calling bash functions in go and other way round.

	bash.Source("main.bash", Asset)
	status, err := bash.Run("main", os.Args[1:])
	

What about launching the whole script?

cannot use reverse (type func([]string) int) as type

github.com/progrium/go-basher/example

./example.go:45: cannot use reverse (type func([]string) int) as type func([]string) in argument to bash.ExportFunc
./example.go:46: cannot use jsonPointer (type func([]string) int) as type func([]string) in argument to bash.ExportFunc
make: *** [build] Error 2

Failure on environment variables with quotes in the value

With environment such as ITERM_PROFILE=Andy's iTerm2, go-basher fail because the value isn't properly escaped:

$ gun
/var/folders/1h/xkn96jrj3d71f_s06j8cnmqc0000gn/T/bashenv.242635297: line 160: syntax error near unexpected token `('
/var/folders/1h/xkn96jrj3d71f_s06j8cnmqc0000gn/T/bashenv.242635297: line 160: ` if grep '^init()' "$filename" > /dev/null; then'
/usr/local/bin/bash: main: command not found

How do we ensure miscellaneous commands(curl .. etc ) are installed?

From the examples

curl -s https://api.github.com/repos/progrium/go-basher | json-pointer /owner/login

How do we ensure curl is installed on a system?
I like your idea.
But we can not assume all misc. commands are installed on a system except bash builin functions.

For fully safe portables binaries,
I think binary shoud include all dependent commands(32bit binary) like busybox.

If go-basher include 32bit statically compiled bash, busybox binaries and using only bash builtins + busybox supported commands, we can say it is fully self-executable binary.

Windows build issue, "undefined RestoreAsset"

I'm trying to build a small tool and cross compile it for Windows, however go-basher is giving me this issue:

$ GOOS=windows GOARCH=amd64 go build main.go 
# github.com/progrium/go-basher
../../../../../go/src/github.com/progrium/go-basher/basher.go:52:9: undefined: RestoreAsset

Builds for Linux and OSX seem to work fine, and go run main.go also runs fine. Do you have any insight on how to solve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.