mirror of
https://github.com/depp/syncfiles.git
synced 2024-11-26 00:49:17 +00:00
022d11fa14
This adds associations between scripts, regions, and character maps, and parses them from a Go utility.
51 lines
867 B
Go
51 lines
867 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
var (
|
|
flagDumpSequences bool
|
|
flagDumpTransitions bool
|
|
)
|
|
|
|
func init() {
|
|
flag.BoolVar(&flagDumpSequences, "dump-sequences", false, "dump Unicode sequences")
|
|
flag.BoolVar(&flagDumpTransitions, "dump-transitions", false, "dump state machine state transition tables")
|
|
}
|
|
|
|
func getSrcdir() (string, error) {
|
|
exe, err := os.Executable()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return filepath.Dir(filepath.Dir(exe)), nil
|
|
}
|
|
|
|
func mainE() error {
|
|
srcdir, err := getSrcdir()
|
|
if err != nil {
|
|
return fmt.Errorf("could not find source dir: %v", err)
|
|
}
|
|
if err := os.Chdir(srcdir); err != nil {
|
|
return err
|
|
}
|
|
d, err := readData()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_ = d
|
|
return nil
|
|
}
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
if err := mainE(); err != nil {
|
|
fmt.Fprintln(os.Stderr, "Error:", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|