37 lines
670 B
Go
37 lines
670 B
Go
|
package entrypoint
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
|
||
|
crypticnet "cryptic-net"
|
||
|
)
|
||
|
|
||
|
// The purpose of this binary is to act as the entrypoint of the cryptic-net
|
||
|
// process. It processes the command-line arguments which are passed in, and
|
||
|
// then passes execution along to an appropriate binary housed in AppDir/bin
|
||
|
// (usually a bash script, which is more versatile than a go program).
|
||
|
|
||
|
func Main() {
|
||
|
|
||
|
env, err := crypticnet.NewEnv(true)
|
||
|
|
||
|
if err != nil {
|
||
|
panic(fmt.Sprintf("loading environment: %v", err))
|
||
|
}
|
||
|
|
||
|
err = subCmdCtx{
|
||
|
args: os.Args[1:],
|
||
|
env: env,
|
||
|
}.doSubCmd(
|
||
|
subCmdDaemon,
|
||
|
subCmdHosts,
|
||
|
subCmdGarage,
|
||
|
subCmdVersion,
|
||
|
)
|
||
|
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|