Pixel art tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
611 B

//go:build !js && !wasm
// +build !js,!wasm
package main
import (
"flag"
"log"
"os"
"path/filepath"
"strings"
"code.rocketnine.space/tslocum/edbit/application"
)
func parseFlags(app *application.Application) {
flag.Parse()
args := flag.Args()
for _, p := range args {
if strings.TrimSpace(p) == "" {
continue
}
if p == "~" {
dir, err := os.UserHomeDir()
if err != nil {
log.Fatal(err)
}
p = dir
} else if strings.HasPrefix(p, "~/") {
dir, err := os.UserHomeDir()
if err != nil {
log.Fatal(err)
}
p = filepath.Join(dir, p[2:])
}
app.OpenFile(p)
}
}