Example #1
0
func main() {
	flag.Parse()
	arg := flag.Arg(0)
	if strings.Index(arg, "Z") == -1 {
		fmt.Printf("%s\n", droscheme.MangleName(arg))
	} else {
		fmt.Printf("%s\n", droscheme.UnmangleName(arg))
	}
}
Example #2
0
func main() {
	gInteract = true

	arguments()

	ds.SetCmdLine(os.Args)

	/* This creates a new environment that is empty
	 * but its parent is the builtin environment.
	 */
	gEnv = ds.BuiltinEnv().Extend()

	if gMangle != "" {
		fmt.Printf("%s\n", ds.MangleName(gMangle))
		os.Exit(0)
	}

	if gUnmangle != "" {
		fmt.Printf("%s\n", ds.UnmangleName(gUnmangle))
		os.Exit(0)
	}

	if gFilename != "" {
		gShell = false
		_, err := ds.Load(gFilename, gEnv)
		if err != nil {
			panic(err)
		}
	}

	if gExpr != "" {
		err := doReadEval(gExpr)
		if err != nil {
			panic(err)
		}
		gShell = false
	}

	if gInteract {
		gShell = true
	}

	if gShell {
		shell()
	}
}